Scripting just the contents of a table

ImarImar Posts: 8 Bronze 2
Hi there,

I really like the data compare options of this tool. However, quite often I need just a simple INSERT script of the data in a specific table and don't need the overhead of comparing two tables or databases with each other.

Here's what I have in mind:

1. I right-click a table and choose Script Data
2. I can either select to script the entire table, or specify a query
3. I can save the results to a script file or a new query window
4. I define how I want identities handled (ignored, scripted etc)
5. I click Script

I then get a file or query window with INSERT statements to regenerate the data in some other database table with a matching schema.

The compare tool seems to support most of this, but it's not easily accessible like this. To do what I am describing above, I have to create a fake table with a matching schema in some random database, and do a compare with the empty table to create my data.

Can a "script only" feature be added to the product someday? Or is something like this already available in another product?

Thanks!

Imar

Comments

  • James BJames B Posts: 1,124 Silver 4
    SQL Packager can create an .exe, c# project or a script from a database without you needing to compare it to anything else.

    You can select the objects you want, so in your case you could select just the one table.

    I think the only issue is that you can only package data for tables where you've already selected to package the schema - but you could edit the script afterwards to remove the table-create portion.

    Hope that helps.
    Systems Software Engineer

    Redgate Software

  • ImarImar Posts: 8 Bronze 2
    Ah, SQL Packager to the rescue. Thanks, that seems mostly what I am looking for indeed.

    May I suggest some improvements here or should I post them in the Packager forum?

    Imar
  • James BJames B Posts: 1,124 Silver 4
    If you have improvements to Packager to suggest, either post them in the forum or mail us direct at support@red-gate.com - we can then log these for the developers to evaluate.
    Systems Software Engineer

    Redgate Software

  • ImarImar Posts: 8 Bronze 2
    Hi James,

    Thanks for your quick replies. I'll send an e-mail to Support.

    Cheers,

    Imar
Sign In or Register to comment.