SQL Server 2012 copy database without data

前端 未结 5 805
星月不相逢
星月不相逢 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:13

    1. Right click your database in your server, and select Tasks > Generate Scripts.
    2. At Introduction step, click Next.
    3. At Choose Objects, you can either select either the entire database (including functions, and etc) or specify what objects you want to generate. In your case, you should select Script entire databases and all database objects then hit Next.
    4. Choose your file name and destination then click next
    5. Review and then click next
    6. Done!

    You will see a .sql file generated in your specified folder. You can open that file in other servers and hit execute, it will then generate a exact same database.

提交回复
热议问题