摘要:
/*创建bbsDB数据库*/use masterif exists(select * from sysdatabases where name='bbsDB')drop database bbsDBcreate database bbsDBon(name='bbsDB_data',filename='D:\project\bbsDB_data.mdf',size=10,filegrowth=20%)log on(name='bbsDB_log',filename='D:\project\bbsDB_log.ldf' 阅读全文
摘要:
SQL Server中判断数据库是否存在: 法(一): select * From master.dbo.sysdatabases where name='数据库名' 法(二): if db_id('数据库名') is not null drop database 。。。 go create 。。。SQL Server中判断表对象是否存在: select count(*) from sysobjects where id = object_id('数据库名.Owner.表名') if exists (select count(*) from s. 阅读全文
摘要:
if object_id(N'tablename',N'U') is not nulldrop table tablenamegoif exists (select * from sysobjects where id = object_id(N'[dbo].[tbname]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[tbname]go 阅读全文