• Home
        • Database Development

          Database development is designing, creating a database or data model, and analyzing requirements and their intents as raw data.

          Learn More
        • Architecture & Design

          Software architecture refers to the fundamental structures of a software system and the discipline of creating such structures and systems.

          Learn More
        • Programming

          Computer programming is the process of performing a particular computation or more generally, accomplishing a specific result.

          Learn More
        • Cloud Computing

          Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power.

          Learn More
        • ETL Development

          ETL provides the foundation for data analytics and machine learning workstreams. Through a series of business rules, ETL cleanses and organizes data.

          Learn More
        • Data Visualization & Reports

          Data and information visualization is an interdisciplinary field that deals with the graphic representation of data and information.

          Learn More
  • Blog
  • Contact

Programmatically Create and Deploy SSIS 2012 Project into Catalog Using C#

Abstract

SQL Server Integration Services 2012 comes with a new API for scripting packages which is called MOM – Managed Object Model. In this article, I will demonstrate the scripting of Integration Services Catalog packages using C#.

Requirements

Article
We begin by launching Microsoft Visual Studio and create a new Integration Services Project which is located under Business Intelligence Projects category.
After you have assigned a project name, proceed to click and drag the Script Task into Control Flow pane from toolbox.
Right click the script task and click on “Edit”
Under the Script Task Editor change the “ScriptLanguage” to “Microsoft Visual C# 2010″.
In Project Explorer, ensure the following references are added:

It is possible that you might not find the Microsoft.SqlServer.Management.IntegrationServices.dll under .NET references in visual studio, in which case I suggest you click here for an article on referencing the missing assembly file.
Back to the code window, ensure that the following namespaces are declared:

  • using System;
  • using Microsoft.SqlServer.Management.IntegrationServices;
  • using Microsoft.SqlServer.Management.Smo;
  • using Microsoft.SqlServer.Dts.Runtime;

Then under your main class create an instance of SMO Server as well as integration services object as shown below:
""
The next part is to create an SSIS Catalog database followed by CatalogFolder, Project, then SSIS packages. It is possible, however, that you might have (or an administrator) created the SSIS Catalog. It is also possible that the CatalogFolder might have been created already. In order to address these possible scenarios, I have created a function with a set of parameters that can be called based on a particular scenario. The function is called:

  • sS_SsisObjCreate(int condition, IntegrationServices sS_Is, Catalog sS_Ct, CatalogFolder sS_Cf)
Now, add the below code in the main class, just after your declarations of SMO Server and Integration Services object.
""
The rest of the code relates to the function “sS_SsisObjCreate” and it looks as follows:
""
""
""
Conclusion

Voilà! Now you can open SQL Server Management Studio and connect to the Server you provided in the above and you should find your newly created packages as shown below:
""
Cheers.
Sifiso.
CodeProject

Loading

Sifiso

October 11, 2022
Sifiso is Data Architect and Technical Lead at SELECT SIFISO – a technology consulting firm focusing on cloud migrations, data ingestion, DevOps, reporting and analytics. Sifiso has over 15 years of across private and public business sectors, helping businesses implement Microsoft, AWS and open-source technology solutions. He is the member of the Johannesburg SQL User Group and also hold a Master’s Degree in MCom IT Management from the University of Johannesburg.

Meet Our Experts

We are proud to have a team of experts who are passionate about delivering the best possible solutions to you. Our team members are highly skilled and experienced in a diverse range of IT technologies, and are committed to staying up-to-date with the latest industry trends and best practices to deliver you the best results.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Join Our Newsletter

Subscribe to get our latest and best thinking on the most definitive workforce topics affecting HR leaders and organizations today.