BlitzSqlExtract2SeedData 1.1.2

A handy little utility to pull the data out of a table in SQL Server, and make it into a SQL Script of INSERT statements for populating a database later. Good for look-up tables, etc.

Install-Package BlitzSqlExtract2SeedData -Version 1.1.2
dotnet add package BlitzSqlExtract2SeedData --version 1.1.2
<PackageReference Include="BlitzSqlExtract2SeedData" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlitzSqlExtract2SeedData --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlitzSqlExtract2SeedData, 1.1.2"
For F# scripts that support #r syntax, copy this into the source code to reference the package.
// Install BlitzSqlExtract2SeedData as a Cake Addin
#addin nuget:?package=BlitzSqlExtract2SeedData&version=1.1.2

// Install BlitzSqlExtract2SeedData as a Cake Tool
#tool nuget:?package=BlitzSqlExtract2SeedData&version=1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SqlExtract2SeedData

An update to a little utility to extract tables in SQL Server to SQL Files for Seed Data

.NET Core 3.1 Runtime or SDK Required

Usage

BlitzSqlExtract2SeedData 1.1.2
Copyright (c) 2020 Blitzkrieg Software

-v, --verbose Set output to verbose messages.

-c, --connectstring Required. Connection String

-t, --table Required. SQL Table To Extract Data From

-o, --orderby (optional) Order By Clause in the form of "order by column1, column2"

-w, --where (optional) Where Clausein the form of "where (column1 = 3)"

-n, --ntop (optional) Top N Rows

-a, --ascsv (optional) Emit CSV instead

--help Display this help screen.

--version Display version information.

Pro Tip: please use quotes around strings like table names, clauses, etc.

Sample Command

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product"

Table notation

Tables can be in the form of:

  • table[dbo].[table]

  • [table][dbo].[table]

  • schema.table[schema].[table]

  • [schema].[table][schema].[table]

  • "table"[dbo].[table]

  • "[table]"[dbo].[table]

  • "schema.table"[schema].[table]

  • "[schema].[table]"[schema].[table]

Where and Order By

You can use where and/or order by clauses, just like you would do in SQL server.

Please supply full valid sql clauses such as:

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -w "Where [IsActive] = 1" -o "Order By [CustomerId]"

Top Modifier

By default, all rows are returned. If -n is specified a Top N clause is added, the rows returned are controlled by the where and order by clauses if supplied, and will be returned in "natural" order otherwise.

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -n 20

or

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -w "Where [IsActive] = 1" -o "Order By [CustomerId]" -n 100

As CSV

Using the flag -a will create a CSV file with TAB delimiters, instead of a seed data SQL Script.

To open it in Excel or Open Office, use the file, open mechanism so that you will be given a chance to set the settings in the text import wizard:

  • Field Delimiter (Tab \t)
  • Row Delimiter (CRLF \r\n)

About Me

SqlExtract2SeedData

An update to a little utility to extract tables in SQL Server to SQL Files for Seed Data

.NET Core 3.1 Runtime or SDK Required

Usage

BlitzSqlExtract2SeedData 1.1.2
Copyright (c) 2020 Blitzkrieg Software

-v, --verbose Set output to verbose messages.

-c, --connectstring Required. Connection String

-t, --table Required. SQL Table To Extract Data From

-o, --orderby (optional) Order By Clause in the form of "order by column1, column2"

-w, --where (optional) Where Clausein the form of "where (column1 = 3)"

-n, --ntop (optional) Top N Rows

-a, --ascsv (optional) Emit CSV instead

--help Display this help screen.

--version Display version information.

Pro Tip: please use quotes around strings like table names, clauses, etc.

Sample Command

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product"

Table notation

Tables can be in the form of:

  • table[dbo].[table]

  • [table][dbo].[table]

  • schema.table[schema].[table]

  • [schema].[table][schema].[table]

  • "table"[dbo].[table]

  • "[table]"[dbo].[table]

  • "schema.table"[schema].[table]

  • "[schema].[table]"[schema].[table]

Where and Order By

You can use where and/or order by clauses, just like you would do in SQL server.

Please supply full valid sql clauses such as:

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -w "Where [IsActive] = 1" -o "Order By [CustomerId]"

Top Modifier

By default, all rows are returned. If -n is specified a Top N clause is added, the rows returned are controlled by the where and order by clauses if supplied, and will be returned in "natural" order otherwise.

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -n 20

or

BlitzSqlExtract2SeedData -c "Server=.\sqlexpress;Database=Bicycle;Trusted_Connection=True;" -t "store.product" -w "Where [IsActive] = 1" -o "Order By [CustomerId]" -n 100

As CSV

Using the flag -a will create a CSV file with TAB delimiters, instead of a seed data SQL Script.

To open it in Excel or Open Office, use the file, open mechanism so that you will be given a chance to set the settings in the text import wizard:

  • Field Delimiter (Tab \t)
  • Row Delimiter (CRLF \r\n)

About Me

Release Notes

Updated for the latest versions of Microsoft SQL Server

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.2 139 12/28/2020