Script(s)

what I learn is what u c

SQL2000 : Drop Database Contents from Query Analyzer

with one comment

U : Table
P : SP
PK : Primary Key
UQ : Unique Constraint
F : Foreign Key
FN : Functions
D : Default

To see the list of User Create Items
– SELECT * FROM sysObjects WHERE xType in (‘U’,'P’,'PK’,'UQ’,'F’,'FN’,'D’)

– Declare @sql NVarChar(4000)– Select @sql= isnull(@sql,”) +’Drop Table ‘ + Name + ‘;’ From sysObjects Where xType=’U'– Exec sp_executesql @sql

– Declare @sql NVarChar(4000)– Select @sql= isnull(@sql,”) +’Drop Proc ‘ + Name + ‘;’ From sysObjects Where xType=’P'– Exec sp_executesql @sql

– Declare @sql NVarChar(4000)– Select @sql= isnull(@sql,”) +’Drop Function ‘ + Name + ‘;’ From sysObjects Where xType=’FN’– Exec sp_executesql @sql

Written by gchandra

February 15, 2006 at 5:27 pm

Posted in Database

One Response

Subscribe to comments with RSS.

  1. [...] SQL2000 : Drop Database Contents from Query Analyzer [...]


Leave a Reply