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

Go To StackoverFlow.com

8

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?

2012-04-05 16:15
by noonand


12

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

SSDT deployment configuration dialogue boxes

2012-05-25 02:28
by Lynn Langit
Thanks Lynn, have made this change and if it doesn't create the database over the next few days I'll change the accepted answe - noonand 2012-05-29 21:33
@Lynn The link to the image is broken, do you know the name of the settings I need to change (and their values) - Marcel Gosselin 2017-06-28 20:50
@Lynn The link is not broken, the site on which the image is hosted was blocked by our company firewall :-( Sorry about tha - Marcel Gosselin 2017-06-29 01:13


6

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

2013-05-07 16:45
by Peter Schott
Great alternate answer: CLI instead of GUI - SandRock 2013-11-12 15:01


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.

2012-04-05 16:53
by gonsalu
And when I do this then it does it for each subsequent build until such time as I change it again - noonand 2012-04-06 14:49
No, I'm afraid I'll have to do it everytime - gonsalu 2012-04-14 13:36


0

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.

2014-07-17 18:30
by Larry Smith
Ads