SQL Server 2012 copy database without data

前端 未结 5 797
星月不相逢
星月不相逢 2020-12-30 20:29

We have a SQL Server 2012 database with test data in it that we used to develop a website. We will shortly need to empty the database and import the real data, but we have c

5条回答
  •  失恋的感觉
    2020-12-30 21:06

    There is one more way, which takes a little longer, but has its benefits. When using the "Generate Scripts" option as others have suggested, we get the entire database and tables script in a ".sql" text file.

    A different approach is to restore the existing database into a new db. You can then delete all data in the tables using a custom script to loop through the tables. Now you have a copy of the database without any data. Take a backup of this to get a familiar ".bak" file.

提交回复
热议问题