数据库项目 - 生成脚本 [英] Database Project - Generate Script

查看:76
本文介绍了数据库项目 - 生成脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Visual Studio数据库项目提供生成脚本,它还会创建增量数据库更改。

Visual studio database project offers Generate Script and its also creates an incremental DB changes.


我可以使用msbuild或命令行或任何其他第三方组件生成脚本。

Can I generate scripts using msbuild or command line or any other third party component.

推荐答案

您好satyajit015,

Hi satyajit015,

感谢您在这里发帖。

您的意思是根据生成的dacpac文件和实际数据库生成发布脚本吗?如果是,请您可以使用SqlPackage.exe 。在你的机器上查找它与
a名称相似的目录:

Do you mean generate the publish script based on the generated dacpac file and the actual database? If yes, you can use SqlPackage.exe. Look for it on your machine in a directory with a name similar to this:

C:\Program Files(x86)\ Microsoft SQL Server \130 \ DAC \ bin

C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin

请注意,它可以在110,120或130文件夹中找到。

Note that it may be found in the 110, 120 or 130 folder.

如果您还没有SqlPackage.exe ,您可以从这里下载:
https://www.microsoft。 com / zh-CN / download / details.aspx?id = 51941

If you don't have SqlPackage.exe already, you can download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=51941

如果您下载它,请务必查看下载页面的"系统要求"部分以查找依赖项SqlSysClrTypes.msi和SqlDom.msi,也必须安装。

If you download it, be sure to look in the System Requirements section of the download page to find the dependencies SqlSysClrTypes.msi and SqlDom.msi, which must be installed as well.

示例用法:

SqlPackage.exe / a:script / SourceFile:C:\ temp \mydb.dacpac / TargetConnectionString:" Data Source = myserver; Initial Catalog = mydb; Integrated Security = true" / OutputPath:C:\ temp

SqlPackage.exe /a:script /SourceFile:C:\temp\mydb.dacpac /TargetConnectionString:"Data Source=myserver;Initial Catalog=mydb;Integrated Security=true" /OutputPath:C:\temp

有关更详细的信息,请参阅:

For some more detailed info, you can refer to:

https://stackoverflow.com/questions/45943575/build-and-generate-script -for-ssdt-project-using-command-line-tools

希望这会有所帮助。


这篇关于数据库项目 - 生成脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆