1. sysobjects system table: each object (such as constraints, default values, logs, rules, and stored procedures) created in the database corresponds to a row.
2. syscolumns system table: returns a row for each column in each table and view, and returns a row for each parameter in the database stored procedure.
3. syscomments system table: contains items for each view, rule, default value, trigger, check constraint, default constraint, and stored procedure in the database. The text column contains the original SQL Definition Statement. The maximum size of these statements is 4 MB.
-- Determine whether a stored procedure exists
If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [sp_sel_tr_tdt] ') and objectproperty (ID, n' isprocedure') = 1)
Begin
Drop procedure sp_sel_tr_tdt
End
-- Determine whether a user table exists
If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [lc_location] ') and objectproperty (ID, n'isusertable') = 1)
Begin
-- Execute the operation
End
-- Determine whether a system table exists
If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [lc_location] ') and objectproperty (ID, n'issystemtable') = 1)
Begin
-- Execute the operation
End
-- Determine whether a Column exists in the User table
If exists (select * From syscolumns where name = 'lc _ opendate' and ID in (select ID from DBO. sysobjects where id = object_id (n' [DBO]. [lc_location] ') and objectproperty (ID, N 'isusertable') = 1 ))
Begin
-- Execute the operation
End