Rapid-fire clear down scripts…

Rapid-fire clear down scripts for Sql server 2005

select ‘drop table ‘ + SS.Name + ‘.’ + SO.name
from sysobjects SO
join sys.schemas SS ON SO.uid = SS.[schema_id]
where type = ‘U’
order by SO.name

select ‘drop function ‘ + SS.Name + ‘.’ + SO.name
from sysobjects SO
join sys.schemas SS ON SO.uid = SS.[schema_id]
where type = ‘FN’
order by SO.name

select ‘drop procedure ‘ + SS.Name + ‘.’ + SO.name
from sysobjects SO
join sys.schemas SS ON SO.uid = SS.[schema_id]
where type = ‘P’ and SS.Name != ‘dbo’
order by SO.name

select ‘drop view ‘ + SS.Name + ‘.’ + SO.name
from sysobjects SO
join sys.schemas SS ON SO.uid = SS.[schema_id]
where type = ‘V’
order by SO.name

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s