Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically create an SSIS Package?

I am trying to programmatically create an SSIS package containing a simple data flow from table A to table B in the same database. I am using the example given here. The package gets created and saved to a dtsx file, but when I open it in visual studio I see that the source and destination tables have not been selected.

I also want to insert a transformation task in between before it reaches the destination.


EDIT

Well I have managed to get the source and destination tables selected and the task even ran successfully. Turns out I needed to

(a) use one oleDB connection each for the source and destination [I don't like this way; I want to use one connection only]

(b) set the Accessmode to 3 in the destination SetComponentProperty("AccessMode", 3) which equates to Table or View - fast load.

Is there some documentation on this somewhere. All I can find is what SetComponentProperty does, and not what all parameters it can take to do that. eg. what else can I put there besides "AccessMode"?, what does the second parameter 3 or 2 or 1 stand for?

Still trying to map the monikers. STOCK:PipelineTask means DataFlow Task. What is the moniker for say... copy column?

like image 257
user20358 Avatar asked Oct 21 '08 10:10

user20358


People also ask

How do I automatically deploy SSIS packages?

Deploying the SSIS Package In Visual Studio, right-click on the project and select Deploy. This will start the SSIS deployment wizard. Keep in mind this will deploy the entire project, with all packages included.

Which programming language is used in SSIS?

SSIS allows the developer to choose between two different scripting languages: C# or Visual Basic (VB). To see where you can make this choice, drop a Script Task onto the Control Flow design surface.


2 Answers

Yes, this is one of my frustrations with SSIS: that they do not provide simple table or map of the new terminology.

You can use a small piece of code to discover components available for use.

The code is located here: http://msdn.microsoft.com/en-us/library/ms136106.aspx

When I ran it, I found the moniker for copy column to be: Name: Copy Column CreationName: DTSTransform.CopyMap.1

like image 186
Maitus Avatar answered Oct 23 '22 06:10

Maitus


If you don't want to use the DTS .net assemblies you can use EzApi which provides a simpler syntax to create SSIS package programmatically.

EzAPI is a .NET library written in C# by Evgeny Koblov one of the testers on the SSIS team to abstracts away a lot of the cumbersome low-level coding needed to create SSIS packages XML directly in a programming language

EzApi was first published as a part of the SSIS community samples project created by Microsoft product team:

  • SQLSrvIntegrationSrv
  • GitHub - MSSQL SSIS community samples

And later it is published as a separate project to add support SQL Server 2016:

  • GitHub - EzApi2016
  • NuGet Gallery - EzApi

To get starteed with EzApi there are many link on the internet that you can refer to such as:

  • EzAPI – Alternative package creation API
  • EzAPI Overview
  • EzApi a C# library for creating SSIS packages programatically
  • Getting Started with EzAPI
like image 44
Hadi Avatar answered Oct 23 '22 07:10

Hadi