这样吧,下面是我试过的脚本,不能执行的
if exists (select * from sysobjects where id = object_id(N'[dbo].[FileList]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[FileList]
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[ResList]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ResList]
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[SortList]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SortList]
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[UserList]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserList]
GO
CREATE TABLE [dbo].[FileList] (
[FileId] [int] IDENTITY (1, 1) NOT NULL ,
[ResId] [int] NOT NULL ,
[fName] [varchar] (50) NOT NULL ,
[fPath] [varchar] (255) NULL ,
[IsFolder] [bit] NULL ,
[fSize] [int] NULL ,
[LastTime] [datetime] NULL ,
[HasChild] [bit] NULL ,
[fNote] [varchar] (8000) NULL ,
[UpNode] [int] NULL ,
[PostUser] [int] NULL ,
[UserLimit] [varchar] (50) NULL
)
GO
CREATE TABLE [dbo].[ResList] (
[ResId] [int] IDENTITY (1, 1) NOT NULL ,
[ResName] [varchar] (30) NOT NULL ,
[SortId] [int] NOT NULL ,
[ResNote] [varchar] (8000) NULL ,
[PostUserId] [int] NOT NULL ,
[PostDate] [datetime] NULL ,
[HasFile] [bit] NOT NULL ,
[UserLimit] [varchar] (50) NULL
)
GO
CREATE TABLE [dbo].[SortList] (
[SortId] [int] IDENTITY (1, 1) NOT NULL ,
[SortName] [varchar] (30) NOT NULL ,
[SortNote] [varchar] (8000) NULL ,
[IsTop] [bit] NULL ,
[UpNode] [int] NULL ,
[HasChild] [bit] NULL ,
[HasRes] [bit] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[UserList] (
[UserId] [int] IDENTITY (1, 1) NOT NULL ,
[UserName] [varchar] (10) NULL ,
[UserPwd] [varchar] (10) NULL ,
[IsAdmin] [bit] NOT NULL
)
GO
即使把前面的if exists和go这部分删除,后面的如CREATE TABLE [dbo].[UserList]还是不能
正确执行。大家看一看呢。