USE [LYFZERPDB] GO /****** Object: Table [dbo].[tb_ErpHospitalDispatchDoor] Script Date: 10/06/2015 14:08:55 ******/ IF not EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalDispatchDoor]') AND type in (N'U')) begin IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalClient]') AND type in (N'U')) DROP TABLE [dbo].[tb_ErpHospitalClient] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalContactRecord]') AND type in (N'U')) DROP TABLE [dbo].[tb_ErpHospitalContactRecord] end GO IF not EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalDispatchDoor]') AND type in (N'U')) begin CREATE TABLE [dbo].[tb_ErpHospitalDispatchDoor]( [id] [int] IDENTITY(1,1) NOT NULL, [Hdr_Number] [nvarchar](20) NULL, [Hdr_DoorTime] [datetime] NULL, [Hdr_DoorPeriod] [varchar](10) NULL, [Hdr_HomeState] [int] NULL, [Hdr_DoorPersonOne] [varchar](20) NULL, [Hdr_DoorPersonTwo] [varchar](20) NULL, [Hdr_Vehicle] [varchar](10) NULL, [Hdr_DoorPersonThree] [varchar](50) NULL, [Hdr_DoorPersonFour] [varchar](20) NULL, [Hdr_CreateDatetime] [datetime] NULL, [Hdr_CreateName] [varchar](20) NULL, ) ALTER TABLE [dbo].[tb_ErpHospitalDispatchDoor] ADD CONSTRAINT [PK__tb_ErpHospitalDi__565FA31D] PRIMARY KEY CLUSTERED ( [id] ASC ) end GO IF not EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalClient]') AND type in (N'U')) begin CREATE TABLE [dbo].[tb_ErpHospitalClient]( [ID] [int] IDENTITY(1,1) NOT NULL, [Hct_Oddnumber] [nvarchar](200) NOT NULL, [Hct_CustomerName] [nvarchar](20) NOT NULL, [Hct_BabyName] [nvarchar](20) NULL, [Hct_BabySex] [nvarchar](2) NULL, [Hct_BabyBirthday] [varchar](50) NULL, [Hct_AreLunar] [bit] NULL, [Hct_BirthdayType] [int] NULL, [Hct_MessageSingle] [nvarchar](2) NULL, [Hct_CustomerOrders] [int] NULL, [Hct_OrderNumber] [nvarchar](50) NULL, [Hct_BabyFeeding] [nvarchar](20) NULL, [Hct_CustomerRegions] [nvarchar](20) NULL, [Hct_CustomerGroups] [nvarchar](20) NULL, [Hct_DealStatus] [nvarchar](6) NULL, [Hct_SingleHospital] [nvarchar](200) NULL, [Hct_MyselfMobile] [nvarchar](200) NULL, [Hct_HusbandMobile] [nvarchar](200) NULL, [Hct_FamilyPhone] [nvarchar](200) NULL, [Hct_Husbandphone] [nvarchar](200) NULL, [Hct_Maidenphone] [nvarchar](200) NULL, [Hct_QQ] [nvarchar](50) NULL, [Hct_PregnantDay] [int] NULL, [Hct_Retail] [nvarchar](20) NULL, [Hct_Remarks] [nvarchar](800) NULL, [Hct_HomeAddress] [nvarchar](300) NULL, [Hct_HomePostcode] [nvarchar](200) NULL, [Hct_HusbandAddress] [nvarchar](300) NULL, [Hct_HusbandPostcode] [nvarchar](200) NULL, [Hct_MaidenAddress] [nvarchar](300) NULL, [Hct_MaidenPostcode] [nvarchar](200) NULL, [Hct_SingleDatetime] [datetime] NULL, [Hcr_BusinessType] [nvarchar](8) NULL, [Hct_BusinessIntention] [nvarchar](8) NULL, [Hct_CreateDatetime] [datetime] NULL, [Hct_CreateName] [nvarchar](20) NULL, [Hct_UpdateDatetime] [datetime] NULL, [Hct_UpdateName] [nvarchar](20) NULL, ) ALTER TABLE [dbo].[tb_ErpHospitalClient] ADD CONSTRAINT [PK_tb_ErpHospitalClient] PRIMARY KEY CLUSTERED ( [ID] ASC, [Hct_Oddnumber] ASC ) end GO IF not EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpHospitalContactRecord]') AND type in (N'U')) begin CREATE TABLE [dbo].[tb_ErpHospitalContactRecord]( [id] [int] IDENTITY(1,1) NOT NULL, [Hcr_Number] [nvarchar](20) NOT NULL, [Hcr_CallTime] [datetime] NULL, [Hcr_CallDuration] [int] NULL, [Hcr_CallType] [nvarchar](8) NULL, [Hcr_Homeaddress] [nvarchar](8) NOT NULL, [Hcr_CallStaff] [nvarchar](20) NULL, [Hcr_CallCases] [nvarchar](6) NULL, [Hcr_CallMode] [nvarchar](8) NULL, [Hcr_RemindTime] [datetime] NULL, [Hcr_Remarks] [nvarchar](800) NULL, [Hcr_CreateDatetime] [datetime] NULL, [Hcr_CreateName] [nvarchar](20) NULL, [Hcr_UpdateDatetime] [datetime] NULL, [Hcr_UpdateName] [nvarchar](20) NULL, ) ALTER TABLE [dbo].[tb_ErpHospitalContactRecord] ADD CONSTRAINT [PK__tb_ErpHospitalCo__139DBB87] PRIMARY KEY CLUSTERED ( [id] ASC, [Hcr_Number] ASC ) end GO