Sql判断数据库、表、存储过程、函数是否存在
发布时间:2020-12-12 12:31:52 所属栏目:MsSql教程 来源:网络整理
导读:判断数据库是否存在 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 t
判断数据库是否存在 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 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 ='全文目录名称' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- sql-server – 从客户端检查与SQL Server的连接的
- 分析MySQL中索引引引发的CPU负载飙升的问题
- mysql常见的错误提示问题处理小结
- sqlserver2005 函数积累
- sql-server-2008 – 为什么Visual Studio 2013架
- sql-server – PowerShell中对Invoke-Sqlcmd的Un
- sql-server-2008 – “SQL server 2008标准”和“
- SqlServer事务日志满的解决方案
- SQL语句实现SQL Server 2000及Sql Server 2005日
- SQLServer2012的数据库发布和订阅方式备份数据
热点阅读