Microsoft SQL Publishing Wizard from the command line
12 settembre 2014
In my opinion, one aspect that has always been missing in MS SQL Server is a convenient tool for scripting the data records of a database, something that MySQL has always had.
Microsoft has a package for this, the Database Publishing Wizard, which is no longer published separately because it has been integrated into Visual Studio 2008 and later. On the Internet you can only find version 1.1.
If you retrieve version 1.4 from somewhere else, or if you have Visual Studio installed, it can be found in a path like this:
cd "C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.4"
Once you have the beloved package, you can use a command like this:
SqlPubWiz.exe script -C "Data Source=mydbserver\myinstance;Initial Catalog=mydbname;uid=myuser;pwd=mypass" output_filename.sql -f -targetserver 2008 -q
And you have a full backup of your SQL database, schema and data, in a single script file.