Click here to Skip to main content
15,881,812 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

How to empty SQL Server 2005 database using cursor & sys.objects (Deleting All Tables, stored procedures, views & UDF’s)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
25 Feb 2010CPOL 6.3K   4  
For Ravi LVS,The way you have suggested to Empty the database by just deleting and recreating it, is not at all smarter way when you are about to empty a remote database located on live database server, There are times when you don't hold such rights of deleting database on Live...
For Ravi LVS,

The way you have suggested to Empty the database by just deleting and recreating it, is not at all smarter way when you are about to empty a remote database located on live database server,

There are times when you don't hold such rights of deleting database on Live database server,

A simple alternate for that is that you generate drop object script and run the drop query,

But even generating drop object script and dropping objects again becomes tedious sometimes. as it goes in two steps 1> generate scripts 2> run that script. and doing so will take double time.

Cheers,
Kiran Dangar

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Gateway Technolabs Pvt. Ltd
India India
Having 4+ years of Technical Experience in asp.net,c#.net, SQL Server 2008,AJAX, XML,JQuery, JavaScript, .net framework, WCF, WPF/Silverlight,SSIS, SSRS, asp.net MVC.

While not working loves Photography and bike riding. Playing computer games are the best stress buster for him Smile | :)

Comments and Discussions

 
-- There are no messages in this forum --