LiveDataScript is a little utility to generate SQL insert scripts from SQL Server databases. I wrote it quite a few years ago, but since it’s still fairly useful and the last place it was hosted has now gone the way of the Dodo, I’ve re-hosted it here.
This post will cover the high-level basics of using the application.
After starting LiveDataScript you’ll be prompted to select the server to connect to:
As you can see, you can use Windows authentication or SQL Server authentication to connect, depending on which is most appropriate for your server.
Once you’re connected you’ll be able to drill into the databases available on the server in the Server Explorer pane:
Double clicking on a table will open it up in a new window:
Scripting data from a table
Scripting all the data
You have a couple of options here:
- Select a table in the Server Explorer and press the Script Tables button ()
- Open a table by double-clicking on it and press the Script Window Results button ()
Note that each of the buttons has a little dropdown associated to it, giving you a choice of where you want to script to, either to a new window, a file or to the clipboard:
Scripting a subset of data
Again, a couple of options:
- Open a table and change the SELECT statement to include a “TOP x” statement, e.g. SELECT TOP 100. Click Refresh Results (or press F5) and then Script Window Results.
- Open a table and highlight the rows that you want to script out, then press Script Selected Rows ()
Selecting the columns to script
You can always change the columns that should be scripted out by altering the SELECT statement, but there is an easier way using the “Script Column Filters” panel:
By simply unselecting columns in this list and scripting the results, you will remove those columns from the resulting output.
That pretty much covers the basics – I’ll write another post soon covering some of the more advanced ways that you can generate scripts.