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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -