Microsoft.SqlServer.Scripting NuGet Package

Contains the necessary SMO dependencies to allow execution of full client-side SQL scripts (eg.

containing the GO command) to be executed from .NET.

Such scripts can be executed from within Management Studio but will fail when executed through ADO.NET. This package contains the dependencies to allow that to happen.

Example usage:

public static void ExecuteSqlScript(SqlConnection conn, string script)
{
var serverConnection = new Microsoft.SqlServer.Management.Common.ServerConnection(conn);
var server = new Microsoft.SqlServer.Management.Smo.Server(serverConnection);
server.ConnectionContext.ExecuteNonQuery(script);
}

PS.

Anyone can download Sql Server Express (for free!) and copy these assemblies from the installation folder, but having a simple package just saves so much pain.




Got any Microsoft.SqlServer.Scripting Question?





Info

Version: 11.0.2100.61
Author(s): Microsoft
Last Update: Tuesday, September 11, 2012
.NET Fiddle: Create the first Fiddle
NuGet Url: https://www.nuget.org/packages/Microsoft.SqlServer.Scripting


Install
Install-Package Microsoft.SqlServer.Scripting
dotnet add package Microsoft.SqlServer.Scripting
paket add Microsoft.SqlServer.Scripting
Microsoft.SqlServer.Scripting Download (Unzip the "nupkg" after downloading)

1 package depend on this package.




STATS

must-have-score

avg-downloads-per-day

120

days-since-last-release

4253