当前位置:首页> 正文

关于sql server:批处理文件以”脚本”数据库

关于sql server:批处理文件以”脚本”数据库

Batch file to “Script” a Database

是否可以通过某种方式使用.bat文件来编写SQL Server数据库的架构和/或内容的脚本?

我可以通过向导执行此操作,但是出于源代码控制的目的,希望简化此文件的创建。

我想避免使用第三方工具,而只限于使用SQL Server随附的工具。


有一个名为SubCommander的免费工具,它是开源SubSonic软件的一部分。我本人已经成功地每天晚上使用此工具来创建架构和数据"转储"。

You can script out your schema and
data (and then version it in your
favorite source control system) using
SubCommander. Simply use the command
"version" and tell SubCommander where
to put the data:

sonic.exe version /out Scripts

This will output a script file (.sql)
to the local scripts directory of your
project

您也可以尝试使用Microsoft SQL Server数据库发布向导,尽管我不确定您是否可以在bat文件中使用它。


展开全文阅读

相关内容