Tuesday, February 23, 2010

How to generate Data script from SQL Database

SQL Server 2005 provides a way to generate a scripts for database schema such as Tables, Stored Procedures, Triggers, Functions, Views etc. That’s a good feature you need when you want to move the database schema form one environment to another environment. But what about data? You guys might faced a challenge to fetch data from production to development and you can not use backup and restore option since If you do so, what ever changes you made in development database will be vanished.



The solution is use Database Publishing Wizard. You can download this tool from here and it will be installed in C:\Program Files\Microsoft SQL Server\90\Tools\Publishing . This wizard is very flexible and you can select different modes like schema only, data only or both.

Good news is the same tool is integrated with in Visual Studio 2008 and SQL Server 2008. so you don’t need to install separately. You can look into the following links for further details
http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/

http://blogs.msdn.com/webdevtools/archive/2007/10/15/sql-database-publishing-wizard-is-now-in-visual-studio-orcas.aspx

Hope this post helped some one.


Before you leave:

  • Tell me whether you like this article or not? Rate this post accordingly by selecting the stars below.
  •  Any suggestion, question or comment? Please post it in the comments below.

0 comments:

Post a Comment