摘要: 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. 阅读全文
posted @ 2013-08-21 09:43 RattanyiXu 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-08-21 09:40 RattanyiXu 阅读(125) 评论(0) 推荐(0) 编辑