SqlServer判断数据库、表、字段、存储过程、函数是否存在
2017-11-14 13:18
281 查看
判断数据库是否存在 if exists (select * from sys.databases where name = '数据库名') --drop database [数据库名] 判断表是否存在 if exists (select * from sysobjects where id = object_id(N'[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) --drop table [表名] if object_id(N'tablename',N'U') is not null print '表存在' else print '表不存在' --判断某表的某字段是否存在 if (not exists(select * from syscolumns where id=object_id('表明') and name='字段名')) print '字段存在' else print '字段不存在' 判断存储过程是否存在 if exists (select * from sysobjects where id = object_id(N'[存储过程名]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) -- drop procedure [存储过程名] 判断函数是否存在 IF OBJECT_ID (N'函数名') IS NOT NULL DROP FUNCTION dnt_split 判断数据库是否开启了全文搜索 select databaseproperty('数据库名','isfulltextenabled') 判断全文目录是否存在 select * from sysfulltextcatalogs where name ='全文目录名称'
相关文章推荐
- SqlServer判断数据库、表、字段、存储过程、函数是否存在
- SqlServer判断数据库、表、存储过程、函数是否存在
- SqlServer判断数据库、表、存储过程、函数是否存在
- SqlServer判断数据库、表、存储过程、函数是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- SQL判断数据库、表、存储过程、视图、函数是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- Sql判断数据库、表、存储过程、函数是否存在
- SQL Server判断数据库、表、存储过程、函数是否存在
- Sql Server判断数据库、表、存储过程、函数是否存在
- SQL判断某个表、存储过程、触发器、函数、某个字段是否存在
- SQL Server判断数据库、表、存储过程、函数是否存在
- Sqlserver 查找存储过程,函数中是否存在某字段
- SQL Server判断数据库、表、存储过程、函数是否存在
- MS SQL 中判断 数据库, 存储过程,表,临时表,视图,函数,用户,用户创建对象 等是否存在 SQL脚本
- SQL常用命令之判断数据库、函数、存储过程、表、视图等是否存在
- sql server 判断数据库、函数、表、存储过程、视图是否存在的方法
- sqlserver 各种判断是否存在(表名、函数、存储过程等)
- 转--查询数据库-字段-表是否存在 sqlserver