sql server - How do you truncate all tables in a database using TSQL? -


i have test environment database want reload new data @ start of testing cycle. not interested in rebuilding entire database- "re-setting" data.

what best way remove data tables using tsql? there system stored procedures, views, etc. can used? not want manually create , maintain truncate table statements each table- prefer dynamic.

for sql 2005,

exec sp_msforeachtable 'truncate table ?' 

couple more links 2000 , 2005/2008..


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -