sql server: delete all the rows of all the tables

前端 未结 4 1935
栀梦
栀梦 2020-12-09 14:06

I\'d like to clear the database altogether and reset the data. What\'s the quickest way to do that? Or, what\'s the command that will delete all the rows of a table (and I\'

4条回答
  •  清歌不尽
    2020-12-09 14:41

    If you don't want to script and drop the tables, there are a number of ways to do this with a loop. Here's probably the easiest:

    sp_MsForEachTable 'TRUNCATE TABLE ?'

提交回复
热议问题