SqlExtract2SeedData 6.2.0

dotnet add package SqlExtract2SeedData --version 6.2.0                
NuGet\Install-Package SqlExtract2SeedData -Version 6.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SqlExtract2SeedData" Version="6.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlExtract2SeedData --version 6.2.0                
#r "nuget: SqlExtract2SeedData, 6.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SqlExtract2SeedData as a Cake Addin
#addin nuget:?package=SqlExtract2SeedData&version=6.2.0

// Install SqlExtract2SeedData as a Cake Tool
#tool nuget:?package=SqlExtract2SeedData&version=6.2.0                

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-2021 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

SqlExtract2SeedData -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:

SqlExtract2SeedData -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.

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

or

SqlExtract2SeedData -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

  • Stuart Williams
  • Cloud/DevOps Practice Lead
  • Magenic Technologies Inc., Office of the CTO
  • <a href="mailto:stuartw@magenic.com" target="_blank">stuartw@magenic.com</a> (e-mail)
  • Blog: <a href="http://blitzkriegsoftware.net/Blog" target="_blank">http://blitzkriegsoftware.net/Blog</a>
  • LinkedIn: <a href="http://lnkd.in/P35kVT" target="_blank">http://lnkd.in/P35kVT</a>
  • YouTube: <a href="https://www.youtube.com/user/spookdejur1962/videos" target="_blank">https://www.youtube.com/user/spookdejur1962/videos</a>
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.2.0 197 11/20/2022

Updated for the latest versions of Microsoft SQL Server