Each object (such as constraints, default values, logs, rules, and stored procedures) created in the database corresponds to a row.
Each object (such as constraints, default values, logs, rules, and stored procedures) created in the database corresponds to a row.
1. System Table sysobjects
Each object (such as constraints, default values, logs, rules, and stored procedures) created in the database corresponds to a row.
Reference
2. syscolumns
Returns a row for each column in each table and view, and returns a row for each parameter of the stored procedure in the database.
Reference
Delete a table in a database
Declare dlist cursor
Select name from sysobjects where xtype = 'U'
Open dlist
Declare @ n varchar (4000)
Fetch next from dlist into @ n
While @ fetch_status = 0
Begin
Declare @ es varchar (4000)
Set @ es = 'drop table
Exec (@ es)
Fetch next from dlist into @ n
End
Close dlist
DEALLOCATE dlist