命令建表

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[guest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[guest]
GO

CREATE TABLE [dbo].[guest] (
 [id] [int] IDENTITY (1, 1) NOT NULL ,
 [name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [sex] [nvarchar] (4) COLLATE Chinese_PRC_CI_AS NULL ,
 [qq] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
 [email] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
 [homepage] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [emot] [nvarchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
 [caption] [nvarchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
 [content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
 [postdate] [datetime] NULL ,
 [standby] [nvarchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
 [reply] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
 [redate] [datetime] NULL ,
 [face] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [ip] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[guest] WITH NOCHECK ADD
 CONSTRAINT [DF_guest_postdate] DEFAULT (getdate()) FOR [postdate],
 CONSTRAINT [DF_guest_redate] DEFAULT (getdate()) FOR [redate]
GO

posted on 2004-04-21 08:34  乔本生涯a  阅读(245)  评论(0编辑  收藏  举报

导航