Making SSDT just generate a SQL script (and not deploy a database)

余生颓废 提交于 2019-11-29 19:12:33

问题


Having recently upgraded to SSDT 2012 I seem to be missing the option to just generate a T-SQL script instead of deploying the database to a server somewhere.

To be more accurate the predecessor to SSDT used to set the Deploy action to 'Generate script', but I cannot locate that option anywhere in the new version.

Is it possible?


回答1:


To generate a script from an offline data project in SSDT rather than deploy to a target database, configure the project settings as shown below




回答2:


You may want to look at the SQLPackage command line. You can set the options there to use an action of "script" and specify an outputfile name to generate scripts instead of publishing the database. You can also do that through a batch file so it will generate a script every time. You still need to provide a source project and target database, though. The reference for SQLPackage can be found here: http://msdn.microsoft.com/en-us/library/hh550080%28v=VS.103%29.aspx




回答3:


Yes, it is possible.

Is you select Build > Publish ProjectName... from the menu bar, a dialog window pops-up with publishing options – there's a Generate Script button at the bottom of the dialog window.




回答4:


I also had a problem where the SSDT project would attempt to deploy changes when the project was run.

In the project properties, choose the "Debug" tab. Change the Start Action to "None". That will prevent it from trying to deploy at that time.



来源:https://stackoverflow.com/questions/10032213/making-ssdt-just-generate-a-sql-script-and-not-deploy-a-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!