Using LiveDataScript

Share on:

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.

Getting started

After starting LiveDataScript you’ll be prompted to select the server to connect to:

image

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:

image

Double clicking on a table will open it up in a new window:

image

Scripting data from a table

Scripting all the data

You have a couple of options here:

  1. Select a table in the Server Explorer and press the Script Tables button (image)
  2. Open a table by double-clicking on it and press the Script Window Results button (image)

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:

image

Scripting a subset of data

Again, a couple of options:

  1. 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.
  2. Open a table and highlight the rows that you want to script out, then press Script Selected Rows (image)

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:

image

By simply unselecting columns in this list and scripting the results, you will remove those columns from the resulting output.

Summary

That pretty much covers the basics – I’ll write another post soon covering some of the more advanced ways that you can generate scripts.