Skip to content

Static Data Scripting

Version control table rows as part of your repository. Use it for small, static or semi-static reference tables and enumerations that must deploy alongside schema.

When to Use

  • Lookup tables (aka static tables, aka reference tables): statuses, countries, tax rates, feature flags.
  • Seed or configuration data required for app startup.

Avoid for high-churn or large transactional tables. A warning appears above 1,000 rows.

How It Works

You “link” a table's data to source control. VersionSQL scripts those rows to a file in your repo. You can see data changes during a commit by examining file diffs. Deployments read the files and apply changes to the target database.

Requirements

  • Table must have a primary key.
  1. Right-click a table → VersionSQL → Link Static Data.
  2. The menu shows a checkmark when the table is linked.
  3. To stop scripting this table's data, use Unlink Static Data.

Script Formats

  • Upsert (insert/update/delete): Default. Generates a script that fills a temp table with rows and runs separate insert, update, and delete statements to keep data in sync.
  • Inserts only: Generates a long list of insert statements, with a truncate statement at the top (disabled by default). Less flexible, but similar to the output of other tooling. Useful if your deployment pipeline or auditors require a flat file of inserts.

Choose the format per connection in settings.

Folder and Files

  • Files are saved under a data folder in your repo. Default: Data.
  • Folder name is configurable (choose from presets or type your own).

Configure

Connection Settings → Advanced → Static Data

  • Add or remove linked tables.
  • Choose Script format and Data folder.

Commits and History

  • Linked tables generate file diffs when data changes.
  • The History view for a linked table shows both schema and data changes together.

Deployments

  • Static data files are applied during deployment.
  • Deletions are disabled by default and can be enabled by changing the StaticDataEnableDeletes SQLCMD variable at the top of the deployment script.