Use MSDeploy to generate import data script

I just found a very helpful tool to generate import data script when deploying database: msdeploy

First download it from here. The tool will be installed in “C:\Program Files\IIS\Microsoft Web Deploy” by default.

To use the tool, fire up command line, go to “C:\Program Files\IIS\Microsoft Web Deploy”  (assume that the tool has been installed in this folder). And type in this command:

C:\Program Files\IIS\Microsoft Web Deploy>msdeploy.exe -verb:sync -source:dbFullSql=”Data Source=[DATABASESERVER]; Initial Catalog=[DATABASENAME];Integrated Security=false ;user id=[USERID];password=[PASSWORD]”,IncludeData=[INCLUDE_DATA],IncludeSchema=[INCLUDE_SCHEMA] -dest:dbFullSql=”[FULL_PATH_TO_SCRIPT_FILE]”

  • [DATABASESERVER]: Computer name or IP address of database server
  • [DATABASENAME]: The name of database from which data are going to be exported
  • [USERID]: Id of user who has access rights to the database server
  • [PASSWORD]: Password to login to database server
  • [INCLUDE_SCHEMA]: Possible values are True or False. If this value is True, the database schema will also be generated
  • [INCLUDE_DATA]: Possible values are True or False. Set this to true to generate import data script
  • [FULL_PATH_TO_SCRIPT_FILE]: the name of the output script file including a path, i.e. C:\DataLoad.sql

Enjoy!

Posted on May 28, 2009, in Database, Programming and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: