· 10 years ago · Sep 17, 2016, 10:10 AM
1USE [erm_nsu_dev]
2GO
3IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_NSU_Main_Profile_Staffs_Documents_CreatedTime]') AND type = 'D')
4BEGIN
5ALTER TABLE [dbo].[NSU_Main_Profile_Staffs_Documents] DROP CONSTRAINT [DF_NSU_Main_Profile_Staffs_Documents_CreatedTime]
6END
7
8GO
9IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_NSU_Main_Profile_Staffs_Documents_Status]') AND type = 'D')
10BEGIN
11ALTER TABLE [dbo].[NSU_Main_Profile_Staffs_Documents] DROP CONSTRAINT [DF_NSU_Main_Profile_Staffs_Documents_Status]
12END
13
14GO
15/****** Object: Table [dbo].[NSU_Main_Profile_Staffs_Documents] Script Date: 9/17/2016 4:04:36 PM ******/
16IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NSU_Main_Profile_Staffs_Documents]') AND type in (N'U'))
17DROP TABLE [dbo].[NSU_Main_Profile_Staffs_Documents]
18GO
19/****** Object: Table [dbo].[NSU_Main_Profile_Staffs_Documents] Script Date: 9/17/2016 4:04:36 PM ******/
20SET ANSI_NULLS ON
21GO
22SET QUOTED_IDENTIFIER ON
23GO
24IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NSU_Main_Profile_Staffs_Documents]') AND type in (N'U'))
25BEGIN
26CREATE TABLE [dbo].[NSU_Main_Profile_Staffs_Documents](
27 [DocumentId] [bigint] IDENTITY(1,1) NOT NULL,
28 [ModuleId] [bigint] NULL,
29 [DocumentTypeId] [int] NULL,
30 [DocumentName] [nvarchar](150) NULL,
31 [Extension] [nvarchar](50) NULL,
32 [Location] [ntext] NULL,
33 [Remarks] [ntext] NULL,
34 [StaffSerialId] [bigint] NULL,
35 [Status] [bit] NULL,
36 [CreatedBy] [bigint] NULL,
37 [CreatedTime] [datetime] NULL,
38 [ModifiedBy] [bigint] NULL,
39 [ModifiedTime] [datetime] NULL,
40 CONSTRAINT [PK_NSU_Main_Profile_Staffs_Documents] PRIMARY KEY CLUSTERED
41(
42 [DocumentId] ASC
43)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
44) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
45END
46GO
47IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_NSU_Main_Profile_Staffs_Documents_Status]') AND type = 'D')
48BEGIN
49ALTER TABLE [dbo].[NSU_Main_Profile_Staffs_Documents] ADD CONSTRAINT [DF_NSU_Main_Profile_Staffs_Documents_Status] DEFAULT ((0)) FOR [Status]
50END
51
52GO
53IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_NSU_Main_Profile_Staffs_Documents_CreatedTime]') AND type = 'D')
54BEGIN
55ALTER TABLE [dbo].[NSU_Main_Profile_Staffs_Documents] ADD CONSTRAINT [DF_NSU_Main_Profile_Staffs_Documents_CreatedTime] DEFAULT (getdate()) FOR [CreatedTime]
56END
57
58GO