JudgmentDatabaseExist?
If exists (select * From SYS. databases where name = 'database name ')
Drop database [database name]
Check whether a table or Column exists in SQL Server to check whether the table exists.
1. Use System View: SYS. Tables
Select name from SYS. tables where name = 'tablaname' and type = 'U'
Type = 'U' is used to exclude stored procedures, views, and system tables. It refers to the user table user_table.
2. Use the System View: sysobjects
Select * From sysobjects where id = object_id ('usersubsyscenthistory _ null') and xtype = 'U'
Xtype = 'U' is used to exclude stored procedures, views, and system tables. It refers to the user table user_table.
Determine whether a stored procedure exists
If exists (select * From sysobjects where id = object_id (n' [stored procedure name] ') and objectproperty (ID, n' isprocedure') = 1)
Drop procedure [stored procedure name]
Determine whether a function exists
If object_id (n' function name') is not null
Drop function dnt_split
Determine whether full-text search is enabled for the database
Select databaseproperty ('database name', 'isfulltextenabled ')
Determine whether the full-text directory exists
Select * From sysfulltextcatalogs where name = 'full-text directory name'