-- Determine whether the database exists
If exists (select * from Master .. sysdatabases where name = 'database name ')
Print 'exists'
Else
Print 'not exists'
-- Determine whether the table name to be created exists
If exists (select * From sysobjects where name = 'table name' and type in ('s ', 'U '))
Print 'exists'
Else
Print 'not exists'
Go
-- Determine whether the temporary table to be created exists
If object_id ('tempdb. DBO. # test') is not null -- # test is the temporary table name.
Begin
Print 'exist'
End
Else
Begin
Print 'nonexistent'
End
---------------
-- Determine whether the stored procedure name to be created exists
If exists (select * From sysobjects where name = 'stored procedure name' and type in ('s', 'P '))
Print 'exists'
Else
Print 'not exists'
Go
-- Determine whether the column name exists
If exists (select O. Name as table name, C. Name as column name
From sysobjects o inner join syscolumns C on O. ID = C. ID
Where o. Name = 'table name' and C. Name = 'column name ')
Select 'exists'
Else
Select 'not exists'
Determines whether a function exists in a table name.
If col_length ('table name', 'column name') is null
Print 'not exists'
Else
Print 'exists'
Note: A is a table, and u represents the data table type.
Type similar to uCode, As shown below
Object Type:
AF = aggregate function (CLR)
C = check Constraints
D = default (constraint or independent)
F = foreign key constraint
PK = primary key constraint
P = SQL stored procedure
PC =ProgramSet (CLR) Stored Procedure
Fn = SQL scalar function
FS = assembly (CLR) scalar function
FT = assembly (CLR) Table Value Function
R = rule (legacy, independent)
Rf = replication filtering process
Sn = Synonym
Sq = <Strong class = "KGB" on Mouseover = "isshowads = false; isshowads2 = false; isshowgg = true; intextads_gglayer =" _ u670d_u52a1 "; keygate_ads.showggads (this," _ u670d_u52a1 ", event) "Style =" border-top-width: 0px; padding-Right: 0px; padding-left: 0px; font-weight: normal; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin: 0px; cursor: hand; color: # 0000ff; padding-top: 0px; border-right-width: 0px; text-Decoration: underline "on Click = "javas Window. Open ("http://www.google.com/aclk? Sa = L & AI = medium ____ centers & num = 2 & Q = http://www2.tek.com/cnweb/products/oscilloscopes/%3FWT.srch%3D1%26WT.mc_id%3Dppc,ggl,scope_aw_ch_cn_scope,k171E,s,766361139%26&sig=AGiWqtxyWRPsXCeA4J63cbgSQs3krP7s8Q "); ggkwclickstat (" service "," www.tektronix.com.cn "," AFS "," 1000016002 "); "On Mouseout = "isshowgg = false; intextads_gglayer =" _ u670d_u52a1 "> Service Queue
Ta = assembly (CLR) DML <Strong class = "KGB" on Mouseover = "isshowads = false; isshowads2 = false; isshowgg = true; intextads_gglayer =" _ blank "; keygate_ads.showggads (this," _ u89e6_u53d1_u5668 ", event) "Style =" border-top-width: 0px; padding-Right: 0px; padding-left: 0px; font-weight: normal; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin: 0px; cursor: hand; color: # 0000ff; padding-top: 0px; border-right-width: 0px; text-Decoration: underline "on Click = "javas Window. Open ("http://www.google.com/aclk? Sa = L & AI = BQIoCOAWHR56sBozu6AOroqCAC5iBlTOIz87RBPDWtnnAmgwQARgBIK-aqgkoAzABOAFQ7tXJy_7 _____ triggers & num = 1 & Q = http://toolbar.google.com/T4/intl/zh-CN/%3Futm_campaign%3DzhCN%26utm_source%3DzhCN-ha-ww-google%26utm_medium%3Dha%26utm_term%3D%25E5%25B7%25A5%25E5%2585%25B7%26tbbrand%3DGZAZ&sig=AGiWqtzKjiNgl3U7aRUdC4tjyZq0F7XBBQ "); ggkwclickstat (" Trigger "," toolbar.google.com/zh-cn "," AFS "," 1000016002 "); "On Mouseout = "isshowgg = false; intextads_gglayer =" _ u89e6_u53d424u5668 ""> trigger
Tr = SQL DML trigger
If = SQL inline table Value Function
TF = SQL table Value Function
U = TABLE (user-defined type)
Uq = unique constraints
V = View
X = Extended Stored Procedure
It = internal table