locked
Deploying data in scripts RRS feed

  • Question

  • Part of my job is to create scripts to deploy data to databases in other environments.  Users add a bunch of data to a bunch of tables.  Then I am asked to generate scripts that look something like this for every row in each table.

    IF NOT EXISTS ( SELECT * FROM [TableA] WHERE [NaturalKey] = 'X' )
        INSERT INTO [TableA]  ( [Column 1], [Column 2], ..., [Column N] )
             VALUES ( Value1, 'value2', ... ValueN )


    Is there a quick way to script data like this?  Scripting Tables, Stored Procedures, Views and Functions is easy, I just use the SQL Server Script Wizard to generate a file for each database object.  The Wizard lets me choose if I want to use IF EXISTS and DROP, etc.  Is there a wizard for scripting data?

    I am using SQL Server 2005 Enterprise Edition.

    Thanks

    Friday, November 13, 2009 12:07 AM

Answers

All replies