Sandip's Programming Zen

An attempt to share tech/coding experiences

Archive for December 2011

Generate SQL script with schema and data for a database

leave a comment »

When we need to quickly send an app which is under development for testing to someone and don’t need to worry which version of SQL server he may have, we should send SQL script for entire database instead of sending database backup file (because if SQL server version will not match, it won’t be restored, which happens often).

To do this easily there is a hidden tool which comes when you install any version of SQL server (developer, enterprise or express). It’s called Database Publishing Wizard, which lets you generate SQL script for your entire database with schema and data. The receiver of this SQL script file just needs to create an empty database and run the script.

Location of the wizard is normally here (in case of SQL server 2008 Express):

C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe

Hope this helps.

 

Advertisements

Written by Sandip

December 17, 2011 at 2:30 pm

Posted in MS SQL