Run an SSIS package from SSMS with Transact-SQL

This quickstart demonstrates how to use SQL Server Management Studio (SSMS) to connect to the SSIS Catalog database, and then use Transact-SQL statements to run an SSIS package stored in the SSIS Catalog.

SQL Server Management Studio is an integrated environment for managing any SQL infrastructure, from SQL Server to SQL Database. For more info about SSMS, see SQL Server Management Studio (SSMS).

Prerequisites

Before you start, make sure you have the latest version of SQL Server Management Studio (SSMS). To download SSMS, see Download SQL Server Management Studio (SSMS).

An Azure SQL Database server listens on port 1433. If you’re trying to connect to an Azure SQL Database server from within a corporate firewall, this port must be open in the corporate firewall for you to connect successfully.

Supported platforms

You can use the information in this quickstart to run an SSIS package on the following platforms:

You cannot use the information in this quickstart to run an SSIS package on Linux. For more info about running packages on Linux, see Extract, transform, and load data on Linux with SSIS.

For Azure SQL Database, get the connection info

To run the package on Azure SQL Database, get the connection information you need to connect to the SSIS Catalog database (SSISDB). You need the fully qualified server name and login information in the procedures that follow.

  1. Log in to the Azure portal.
  2. Select SQL Databases from the left-hand menu, and then select the SSISDB database on the SQL databases page.
  3. On the Overview page for your database, review the fully qualified server name. To see the Click to copy option, hover over the server name.
  4. If you forget your Azure SQL Database server login information, navigate to the SQL Database server page to view the server admin name. You can reset the password if necessary.

Connect to the SSISDB database

Use SQL Server Management Studio to establish a connection to the SSIS Catalog on your Azure SQL Database server.

  1. Open SQL Server Management Studio.
  2. In the Connect to Server dialog box, enter the following information:TABLE 1SettingSuggested valueMore infoServer typeDatabase engineThis value is required.Server nameThe fully qualified server nameIf you’re connecting to an Azure SQL Database server, the name is in this format: <server_name>.database.windows.net.AuthenticationSQL Server AuthenticationWith SQL Server authentication, you can connect to SQL Server or to Azure SQL Database. If you’re connecting to an Azure SQL Database server, you can’t use Windows authentication.LoginThe server admin accountThis account is the account that you specified when you created the server.PasswordThe password for your server admin accountThis password is the password that you specified when you created the server.
  3. Click Connect. The Object Explorer window opens in SSMS.
  4. In Object Explorer, expand Integration Services Catalogs and then expand SSISDB to view the objects in the SSIS Catalog database.

Run a package

Run the following Transact-SQL code to run an SSIS package.

  1. In SSMS, open a new query window and paste the following code. (This code is the code generated by the Script option in the Execute Package dialog box in SSMS.)
  2. Update the parameter values in the catalog.create_execution stored procedure for your system.
  3. Make sure that SSISDB is the current database.
  4. Run the script.
  5. In Object Explorer, refresh the contents of SSISDB if necessary and check for the project that you deployed.

SQLCopy

Declare @execution_id bigint
EXEC [SSISDB].[catalog].[create_execution] @package_name=N'Package.dtsx',
    @execution_id=@execution_id OUTPUT,
    @folder_name=N'Deployed Projects',
	  @project_name=N'Integration Services Project1',
  	@use32bitruntime=False,
	  @reference_id=Null
Select @execution_id
DECLARE @var0 smallint = 1
EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id,
    @object_type=50,
	  @parameter_name=N'LOGGING_LEVEL',
	  @parameter_value=@var0
EXEC [SSISDB].[catalog].[start_execution] @execution_id
GO

Reference

https://docs.microsoft.com/en-us/sql/integration-services/ssis-quickstart-run-tsql-ssms?view=sql-server-ver15

How to run ssis package in asp.net core application?

You can package the assembly into a nuget package, Create a Lib folder inside your solution to hold the nuget package, then, create a nuget.config file to set the package sources to include the Lib folder inside your solution.

The following links contains more details about creating nuget package and hosting it locally:

Alternate Method – 1

To run SSIS package you need below DLLs in the code

  1. Microsoft.SqlServer.ManagedDTS.dll
  2. Microsoft.SqlServer.PipelineHost.dll
  3. Microsoft.SqlServer.DTSRuntimeWrap.dll
  4. Microsoft.SqlServer.DTSPipelineWrap.dll

It is easy to add DLLs in MVC projects, however in asp.net core it needs to be in form of a Nuget package.

So nuget package can be easily created using nuget package explorer. Below is the link

https://docs.nuget.org/create/using-a-gui-to-build-packages

In the nuget package explorer add a lib folder, inside that add a .net folder dnxcore50 and add the above DLLs. Click on tools analyse package and save the nuget.

In the visual studio 2015 solution, you can refer local packages. Tools – Nuget Package Manager – Package Manager Settings – Package source add the local package path.

After which you will be able to add the nuget package using nuget package manager and select local package as source

"dependencies": {
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027",
"SSISPackage": "1.0.0"
 }

"frameworks": {
"netcoreapp1.0": {
  "imports": [
    "dotnet5.6",
    "portable-net45+win8",
    "dnxcore"
  ]
  }
}

After which you will be able to use code to run SSIS package similar to MVC projects.

Application app = new Application();
        Package package = null;
        try
        {
            package = app.LoadPackage(@"C:\Files\Package.dtsx", null);
            Variables vars = package.Variables;
            vars["status"].Value = "ACTIVE";

            DTSExecResult results = package.Execute();

        }
        catch
        {
            return false;

        }
        finally
        {
            package.Dispose();
            package = null;
        }

Alternate Method – 2

You may now reference the dlls ( one from each) directly in your .net core project from the below locations to run ssis packages now

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ManagedDTS
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.PipelineHost
C:\Windows\Microsoft.NET\assembly\GAC_64\Microsoft.SqlServer.DTSRuntimeWrap
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.DTSPipelineWrap

you no longer need to create a nuget package

Reference

https://stackoverflow.com/questions/38791987/how-to-run-ssis-package-in-asp-net-core-application

Edit script in SSIS is not working

This started today. The edit script stopped working in VS 2017. Here is the work around;

The issue may occur because the Script Task is not installed properly.

VS 2017 solution

Here are two options that might help;

Option # 1

Open control panel and try to repair “Microsoft Visual Studio Tools for Applications 2017”.

This options has helped me after upgrading VS SSDT 2017 recently. The funny things is that you don’t need to repair “Microsoft SQL Server Data Tools for Visual Studio 2017 (SSDT). Anyway it worked.

Option # 2

Please check whether the Microsoft.SqlServer.ScriptTask.dll file exists in the following folders (supposing it is a 64-bit platform):

  1. C:\Program Files\Microsoft SQL Server\110\DTS\Tasks
  2. C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Tasks
  3. C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ScriptTask\v4.0_11.0.0.0__89845dcd8080cc91

If the Microsoft.SqlServer.ScriptTask.dll file is missing in any of the folders, copy one (from the other folders or a different working SSIS server) to the folder. Alternatively, you can also use the command line tool gacutil.exe to install the task assembly into the global assembly cache (GAC)

If above work around does not work, then do this;

Uninstall SSDT from your machine

Reboot the machine so that no cache issue

Reinstall SSDT with the option Install new SQL Server Data Tools for Visual Studio 2017 instance (SSDT), like below. Do not install in your existing Visual Studio instance again.

VS 2019 Solution

Download and Install this patch from Microsoft;

https://www.microsoft.com/en-us/download/details.aspx?id=58317

Here is the reference to this download;

https://docs.microsoft.com/en-us/answers/questions/303968/visual-studio-2019-1690-ssis-script-task-vsta-wont.html

Hope this will help.

Entity Framework Core tools reference .NET Core CLI

The command-line interface (CLI) tools for Entity Framework Core perform design-time development tasks. For example, they create migrations, apply migrations, and generate code for a model based on an existing database.

dotnet ef can be installed as either a global or local tool. Most developers prefer installing dotnet ef as a global tool using the following command:

dotnet tool install –global dotnet-ef

Update the tool tool using the following command:

dotnet tool update –global dotnet-ef

Before you can use the tools on a specific project, you’ll need to add the Microsoft.EntityFrameworkCore.Design package to it.

dotnet add package Microsoft.EntityFrameworkCore.Design

Verify installation

dotnet ef

The output from the command identifies the version of the tools in use:

For further details, refer to this link;

https://docs.microsoft.com/en-us/ef/core/cli/dotnet

Cheapest Development Environment for Azure Kubernetes Service

I am trying to setup cheapest development environment for Azure Kubernetes journey. I am provisioing this service in East US so all prices are in USD;

az aks create –name myakscluster

This will bring up Standard_DS2_v2 node that cost $106.58 at the time of this writing.

I like to drop it a smaller VM. AKS specification are that every AKS cluster will have at minimum one node pool and node pool require a VM SKU of at least 2 vCPUs and 4GM memory. The cheapest VM at that configuration is Standard_B2s that cost about $30.37.

–node-count 1 –node-vm-size Standard_B2s

AKS uses a Load Balancer and by default the Standard sku @ ~$30/month will be selected. The Basic sku is free, but the Load Balancer sku cannot be changed once the cluster has been created, so we must set it at time of creation.

–load-balancer-sku basic

Disk size defaults to 100GB which for this VM is a Premium SSD p10 @ 19.79/month. Minimum disk size is 30 so we’ll choose the 32GB p4 @ $1.54/month.

The cheapest cluster power shell is;
az aks create -n myakscluster \
–node-count 1 \
–node-vm-size Standard_B2s \
–load-balancer-sku basic \
–node-osdisk-size 32

Hope, this will save some money on compute, storage and networking during development.