Advertisement
Guest User

Untitled

a guest
Sep 25th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 3.95 KB | None | 0 0
  1. USE [eForms]
  2. GO
  3.  
  4. /****** Object:  Table [dbo].[RoutePlan]    Script Date: 9/25/2014 12:36:14 PM ******/
  5. SET ANSI_NULLS ON
  6. GO
  7.  
  8. SET QUOTED_IDENTIFIER ON
  9. GO
  10.  
  11. SET ANSI_PADDING ON
  12. GO
  13.  
  14. CREATE TABLE [dbo].[RoutePlan](
  15.     [RoutePlanId] [int] IDENTITY(1,1) NOT NULL,
  16.     [FormId] [int] NOT NULL,
  17.     [UserId] [int] NOT NULL,
  18.     [Rank] [int] NOT NULL,
  19.     [RoutePlanStatusId] [int] NULL,
  20.     [StatusDate] [datetime] NULL,
  21.     [Notes] [varchar](500) NULL,
  22.     [IsStrict] [bit] NOT NULL,
  23.     [RoutePlanResponsibilityId] [int] NOT NULL,
  24.     [IsPostApproval] [bit] NOT NULL,
  25.     [ProcessedByUserId] [int] NULL,
  26.     [Deleted] [bit] NOT NULL,
  27.     [CreatedById] [int] NULL,
  28.     [CreatedDate] [datetime] NULL,
  29.     [ModifiedById] [int] NULL,
  30.     [ModifiedDate] [datetime] NULL,
  31.  CONSTRAINT [PK_RoutePlan_1] PRIMARY KEY CLUSTERED
  32. (
  33.     [RoutePlanId] ASC
  34. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  35. ) ON [PRIMARY]
  36.  
  37. GO
  38.  
  39. SET ANSI_PADDING OFF
  40. GO
  41.  
  42. ALTER TABLE [dbo].[RoutePlan] ADD  CONSTRAINT [DF_RoutePlan_RoutePlanResponsibilityId]  DEFAULT ((1)) FOR [RoutePlanResponsibilityId]
  43. GO
  44.  
  45. ALTER TABLE [dbo].[RoutePlan] ADD  CONSTRAINT [DF_RoutePlan_IsPostApproval]  DEFAULT ((0)) FOR [IsPostApproval]
  46. GO
  47.  
  48. ALTER TABLE [dbo].[RoutePlan] ADD  CONSTRAINT [DF_RoutePlan_Deleted]  DEFAULT ((0)) FOR [Deleted]
  49. GO
  50.  
  51. ALTER TABLE [dbo].[RoutePlan]  WITH CHECK ADD  CONSTRAINT [FK_RoutePlan_Form] FOREIGN KEY([FormId])
  52. REFERENCES [dbo].[Form] ([FormId])
  53. GO
  54.  
  55. ALTER TABLE [dbo].[RoutePlan] CHECK CONSTRAINT [FK_RoutePlan_Form]
  56. GO
  57.  
  58. ALTER TABLE [dbo].[RoutePlan]  WITH NOCHECK ADD  CONSTRAINT [FK_RoutePlan_RoutePlanResponsibility] FOREIGN KEY([RoutePlanResponsibilityId])
  59. REFERENCES [dbo].[RoutePlanResponsibility] ([RoutePlanResponsibilityId])
  60. GO
  61.  
  62. ALTER TABLE [dbo].[RoutePlan] CHECK CONSTRAINT [FK_RoutePlan_RoutePlanResponsibility]
  63. GO
  64.  
  65. ALTER TABLE [dbo].[RoutePlan]  WITH CHECK ADD  CONSTRAINT [FK_RoutePlan_RoutePlanStatus] FOREIGN KEY([RoutePlanStatusId])
  66. REFERENCES [dbo].[RoutePlanStatus] ([RoutePlanStatusId])
  67. GO
  68.  
  69. ALTER TABLE [dbo].[RoutePlan] CHECK CONSTRAINT [FK_RoutePlan_RoutePlanStatus]
  70. GO
  71.  
  72. ALTER TABLE [dbo].[RoutePlan]  WITH CHECK ADD  CONSTRAINT [FK_RoutePlan_UserInfo] FOREIGN KEY([UserId])
  73. REFERENCES [dbo].[UserInfo] ([login_id])
  74. GO
  75.  
  76. ALTER TABLE [dbo].[RoutePlan] CHECK CONSTRAINT [FK_RoutePlan_UserInfo]
  77. GO
  78.  
  79.  
  80. USE [eForms]
  81. GO
  82.  
  83. /****** Object:  Table [dbo].[Form]    Script Date: 9/25/2014 12:37:50 PM ******/
  84. SET ANSI_NULLS ON
  85. GO
  86.  
  87. SET QUOTED_IDENTIFIER ON
  88. GO
  89.  
  90. SET ANSI_PADDING ON
  91. GO
  92.  
  93. CREATE TABLE [dbo].[Form](
  94.     [FormId] [int] IDENTITY(1,1) NOT NULL,
  95.     [TypeId] [int] NOT NULL,
  96.     [EmployeeIndex] [int] NULL,
  97.     [NonEmployeeName] [varchar](500) NULL,
  98.     [FormStatusId] [int] NOT NULL,
  99.     [PreviousFormId] [int] NULL,
  100.     [ClosedDate] [datetime] NULL,
  101.     [ExecutedById] [int] NULL,
  102.     [ExecutedDate] [datetime] NULL,
  103.     [Deleted] [bit] NOT NULL,
  104.     [CreatedById] [int] NOT NULL,
  105.     [CreatedDate] [datetime] NOT NULL,
  106.     [ModifiedById] [int] NULL,
  107.     [ModifiedDate] [datetime] NULL,
  108.     [RegionCode] [varchar](4) NULL,
  109.     [HiddenFromEmployee] [bit] NULL,
  110.  CONSTRAINT [PK_Forms] PRIMARY KEY CLUSTERED
  111. (
  112.     [FormId] ASC
  113. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  114. ) ON [PRIMARY]
  115.  
  116. GO
  117.  
  118. SET ANSI_PADDING OFF
  119. GO
  120.  
  121. ALTER TABLE [dbo].[Form] ADD  CONSTRAINT [DF_Form_Deleted]  DEFAULT ((0)) FOR [Deleted]
  122. GO
  123.  
  124. ALTER TABLE [dbo].[Form] ADD  CONSTRAINT [DF_Form_HiddenFromEmployee]  DEFAULT ((0)) FOR [HiddenFromEmployee]
  125. GO
  126.  
  127. ALTER TABLE [dbo].[Form]  WITH CHECK ADD  CONSTRAINT [FK_Form_Form1] FOREIGN KEY([PreviousFormId])
  128. REFERENCES [dbo].[Form] ([FormId])
  129. GO
  130.  
  131. ALTER TABLE [dbo].[Form] CHECK CONSTRAINT [FK_Form_Form1]
  132. GO
  133.  
  134. ALTER TABLE [dbo].[Form]  WITH CHECK ADD  CONSTRAINT [FK_Form_FormStatus] FOREIGN KEY([FormStatusId])
  135. REFERENCES [dbo].[FormStatus] ([FormStatusId])
  136. GO
  137.  
  138. ALTER TABLE [dbo].[Form] CHECK CONSTRAINT [FK_Form_FormStatus]
  139. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement