Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pecunn
Starting Member
20 Posts |
Posted - 2011-07-29 : 04:04:36
|
| Hi Guru,Could someone tell me how to clean up the database,so basically delete all the data from database and ignore all the database relationship?force to truncate in each tables in database.Thanks in advance |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-29 : 04:39:13
|
| you can create a cursor script to loop through tables in db and then use TRUNCATE TABLE <tablename> to clear it. use INFORMATION_SCHEMA.TABLES catalog view to get table list. Make sure you drop all FKs in db before you do this. Details of FKs can be got from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|