Script entire database SQL-Server

前端 未结 7 1281
慢半拍i
慢半拍i 2020-12-02 13:06

Is there a way I can get a scripting of all tables, procs, and other objects from a database? I know there\'s an option to script the database but it only gave me some sort

7条回答
  •  萌比男神i
    2020-12-02 13:13

    I wrote an open source command line utility named SchemaZen that does this. It's much faster than scripting from management studio and it's output is more version control friendly. It supports scripting both schema and data.

    To generate scripts run:

    schemazen.exe script --server localhost --database db --scriptDir c:\somedir

    Then to recreate the database from scripts run:

    schemazen.exe create --server localhost --database db --scriptDir c:\somedir

提交回复
热议问题