SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[USERS]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[USERS](
[userID] [int] IDENTITY(1,1) NOT NULL,
[userName] [varchar](20) NOT NULL,
[password] [varchar](20) NOT NULL,
[status] [int] NOT NULL,
CONSTRAINT [PK_USERS] PRIMARY KEY CLUSTERED
(
[userID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Message]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Message](
[Id] [int] IDENTITY(1,1) NOT NULL,
[title] [varchar](50) NOT NULL,
[content] [varchar](200) NOT NULL,
[personName] [varchar](50) NOT NULL,
[writeDate] [varchar](50) NULL CONSTRAINT [DF_Message_writeDate] DEFAULT (getdate()),
CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NEWS]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[NEWS](
[newsID] [int] IDENTITY(1,1) NOT NULL,
[title] [varchar](50) NOT NULL,
[content] [varchar](400) NULL,
[writerDate] [varchar](50) NULL CONSTRAINT [DF_NEWS_writerDate] DEFAULT (getdate()),
CONSTRAINT [PK_NEWS] PRIMARY KEY CLUSTERED
(
[newsID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PRODUCT]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[PRODUCT](
[productID] [int] IDENTITY(1,1) NOT NULL,
[serialNumber] [varchar](20) NULL,
[name] [varchar](20) NOT NULL,
[brand] [varchar](20) NULL,
[model] [varchar](20) NULL,
[price] [varchar](50) NULL,
[picture] [varchar](20) NULL,
[description] [varchar](800) NULL,
CONSTRAINT [PK_PRODUCT] PRIMARY KEY CLUSTERED
(
[productID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rever]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Rever](
[Id] [int] IDENTITY(1,1) NOT NULL,
[MessageId] [int] NOT NULL,
[title] [varchar](50) NULL,
[content] [varchar](200) NOT NULL,
[person] [varchar](50) NULL,
[wDate] [varchar](50) NULL CONSTRAINT [DF_Rever_wDate] DEFAULT (getdate()),
CONSTRAINT [PK_Rever] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Rever_Message]') AND parent_object_id = OBJECT_ID(N'[dbo].[Rever]'))
ALTER TABLE [dbo].[Rever] WITH CHECK ADD CONSTRAINT [FK_Rever_Message] FOREIGN KEY([MessageId])
REFERENCES [dbo].[Message] ([Id])
- 1
- 2
- 3
- 4
前往页