Sql Server中判断表或者数据库是否存在
来源:互联网 发布:小米平板软件 编辑:程序博客网 时间:2024/05/01 23:05
法(一): select * From master.dbo.sysdatabases where name='数据库名' 法(二): drop database 。。。 create 。。。 SQL Server中判断表对象是否存在: if exists (select count(*) from sysobjects where id = object_id('数据库名.Owner.表名')) SQL Server中判断表中字段是否存在: (select * from syscolumns where name='colname1' and id=object_id('数据库名.Owner.表名')) SQL Server中判断存储过程或视图是否存在: if object_id('视图或存储过程名') is not null create proc/view 。。。 或 if Exists(select * from sysobjects where name='视图或存储过程名' AND type = 'P/V') create proc/view 。。。
if db_id('数据库名') is not null
go
select count(*) from sysobjects where id = object_id('数据库名.Owner.表名')
print '存在'
else
print '不存在'
if exists
print '存在'
else
print '不存在'
(代表表tablename1中存在colname1字段 )
例:
select * from syscolumns where name='Test' and id=object_id('dbo.test')
drop proc/view 。。。
go
drop proc/view 。。。
go
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中判断表或者数据库是否存在
- Sql Server中如何判断表或者数据库的存在
- SQL Server中判断数据库是否存在
- Sql server中判断表是否存在
- SQL Server中判断一个数据库是否存在的方法
- SQL Server中判断一个数据库是否存在的方法
- SQL Server中判断一个数据库是否存在的方法
- SQL Server中如何判断一个数据库是否存在
- ASP 中判断SQLSERVER 表或者数据库是否存在
- sql server如何判断数据库是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- 第一节--认识Activity
- 一个函数命名所引发的思考
- 工信部与广东开展软件名城创建试点工作
- wince 开发环境 搭建
- Android插入和获取联系人详情
- Sql Server中判断表或者数据库是否存在
- 十二月各地中小企业扶持政策汇总
- openfire 源码编译
- 十二月各地中小企业扶持政策汇总
- 进制间转换
- CString转换 char
- java对象复制
- 环境变量
- J2EE Design Patterns 1 Intercepting Filter(截取筛选器)