How can I generate a script of my database as it is?

前端 未结 6 1580
孤街浪徒
孤街浪徒 2021-02-02 17:18

My primary reason for this is to keep track of database schema changes for my application. In SQL Server Management Studio I am able to generate a create script which creates t

6条回答
  •  情深已故
    2021-02-02 17:54

    You didn't mention which version of SQL Server, but in SQL 2008 this is very easy

    SQL 2008
    Expand Databases
    Right Click Database
    Choose Tasks > Generate Scripts
    Generate and Publish Dialog will open
    Choose your objects (i.e. Tables, procs, etc)
    Click Next On the Set Scripting
    Options choose Advanced Options
    Under General choose SCRIPT DROP AND CREATE - SCRIPT DROP AND CREATE
    Types of Data To Script - Schema and Data
    Close Advanced Window
    Choose to save to file.

提交回复
热议问题