IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

SSIS Best Practice with Naming Conventions

In 2006, Jamie Thomson originally came up with naming conventions for SSIS tasks and data flow components which makes packages and logs more readable and easier to find.

Koen Verbeeck and André Kamman extended the existing list with almost 40 tasks/components since then.

This list should be used just as a reference if you want to use standard naming convention in SSIS.

The point is whether or not you want to follow this naming standard, it’s always better to use a standard for your package maintainability and readibility.

Task

The acronyms below can be used at the beginning of the names of tasks to identify what type of task it is.

TaskPrefix
For Loop ContainerFLC
Foreach Loop ContainerFELC
Sequence ContainerSEQC
ActiveX ScriptAXS
Analysis Services Execute DDLASE
Analysis Services ProcessingASP
Azure Blob DownloadADT
Azure Blob UploadAUT
Azure HDInsight Create ClusterACCT
Azure HDInsight Delete ClusterACDT
Azure HDInsight HiveAHT
Azure HDInsight PigAPT
Back Up DatabaseBACKUP
Bulk InsertBLK
CDC ControlCDC
Check Database IntegrityCHECKDB
Data FlowDFT
Data Mining QueryDMQ
Data ProfilingDPT
Execute DTS 2000 PackageEDPT
Execute PackageEPT
Execute ProcessEPR
Execute SQL Server Agent JobAGENT
Execute SQLSQL
Execute T-SQL StatementTSQL
File SystemFSYS
FTPFTP
Hadoop File SystemHFSYS
Hadoop HiveHIVE
Hadoop PigPIG
History CleanupHISTCT
Maintenance CleanupMAINCT
Message QueueMSMQ
Notify OperatorNOT
Rebuild IndexREBIT
Reorganize IndexREOIT
ScriptSCR
Send MailSMT
Shrink DatabaseSHRINKDB
Transfer DatabaseTDB
Transfer Error MessagesTEM
Transfer JobsTJT
Transfer LoginsTLT
Transfer Master Stored ProceduresTSP
Transfer SQL Server ObjectsTSO
Update StatisticsSTAT
Web ServiceWST
WMI Data ReaderWMID
WMI Event WatcherWMIE
XMLXML
ExpressionEXPR

Components

These acronyms should be used at the beginning of the names of components to identify what type of component it is.

ComponentPrefix
ADO NET SourceADO_SRC
Azure Blob SourceAB_SRC
CDC SourceCDC_SRC
DataReader SourceDR_SRC
Excel SourceEX_SRC
Flat File SourceFF_SRC
HDFS File SourceHDFS_SRC
OData SourceODATA_SRC
ODBC SourceODBC_SRC
OLE DB SourceOLE_SRC
Raw File SourceRF_SRC
XML SourceXML_SRC
AggregateAGG
AuditAUD
Balanced Data DistributorBDD
Cache TransformCCH
CDC SplitterCDCS
Character MapCHM
Conditional SplitCSPL
Copy ColumnCPYC
Data ConversionDCNV
Data Mining QueryDMQ
Derived ColumnDER
DQS CleansingDQSC
Export ColumnEXPC
Fuzzy GroupingFZG
Fuzzy LookupFZL
Import ColumnIMPC
LookupLKP
MergeMRG
Merge JoinMRGJ
MulticastMLT
OLE DB CommandCMD
Percentage SamplingPSMP
PivotPVT
Row CountCNT
Row SamplingRSMP
Script ComponentSCR
Slowly Changing DimensionSCD
SortSRT
Term ExtractionTEX
Term LookupTEL
Union AllALL
UnpivotUPVT
ADO NET DestinationADO_DST
Azure Blob DestinationAB_DST
Data Mining Model TrainingDMMT_DST
Data Streaming DestinationDS_DST
DataReader DestinationDR_DST
Dimension ProcessingDP_DST
Excel DestinationEX_DST
Flat File DestinationFF_DST
HDFS File DestinationHDFS_DST
ODBC DestinationODBC_DST
OLE DB DestinationOLE_DST
Partition ProcessingPP_DST
Raw File DestinationRF_DST
Recordset DestinationRS_DST
SharePoint List DestinationSPL_DST
SQL Server Compact DestinationSSC_DST
SQL Server DestinationSS_DST
SQL Server Mobile DestinationSSM_DST

Further Reading

SSIS Naming Conventions 2.0
How to Add Custom Logging to SSIS Package

January 9, 2023 Filed Under: Tips and Tricks Tagged With: ETL, Microsoft, SSIS

How to Quickly Query LDAP in Visual Studio SSIS

At times, you need to do a quick query against LDAP, but if your access is quite restricted, sometimes instead of using SQL Server Management Studio, you can also use SSIS Project within Visual Studio to do it.

Steps

  1. Launch Visual Studio.

  2. Create a new project and double-click on Integration Services Project.

    Visual Studio New Integration Services Project

  3. Name your Project name (e.g. ITNotaQueryLDAP), then click Create button.

    Visual Studio Configure New Integration Services Project

  4. For this exercise, we use the default Package.dtsx. If it’s not opened by default, just double click it on the right pane window.

  5. Drag Data Flow Task from SSIS Toolbox window to the Control Flow window.

    Add Data Flow Task to Control Flow in SSIS

  6. Now we want to add a Connection Manager by right-clicking on a blank area under Connection Managers pane and select New ADO.NET Connection….

    Add a new ADO.NET Connection in SSIS Connection Managers

    A smaller window titled Configure ADO.NET Manager will pop up, click on the New button.

    Create a new OLE DB Connection Manager in SSIS

  7. In a Connection Manager window, for the Provider, select OLE DB Provider for Microsoft Directory Services (under .Net Providers for OleDb). Then, click OK.

    OLE DB Provider for Microsoft Directory Services - .Net Providers\SqlClient Data Provider in SSIS

  8. Once you’re back in Connection Manager window, click on the Test Connection button. Make sure you see the Test connection succeeded screen. Click both OK buttons.

    SSIS Test Connection Manager (Successful)

  9. After you clicked OK, you can see the configuration summary of your SSIS connection. Click OK again.

    SSIS Connection Manager Configuration Summary

  10. At this point, you have a Data Connection in your Connection Managers which you can rename to LDAP Data Connection.

    Rename Connection Manager to LDAP Data Connection in SSIS

  11. Next, you can either double-click on the Data Flow Task or click on the Data Flow tab and drag ADO NET Source from the left pane, under Other Sources.

    Double click on the ADO NET Source box, and select the LDAP Data Connection for ADO.NET connection manager:, SQL command for Data access mode: and use the following SQL command as an example under SQL Command text:.

    LDAP://DC=ITNota,DC=Corp,DC=com;(&(objectCategory=Person)
    (SN=Smith));SN,givenName,displayName,
    mailNickName,sAMAccountName,mail,msExchHideFromAddressLists,
    homeMDB;subtree
    

    This query specifically looks for all records for anyone with a last name of “Smith” in the domain. You need to replace the values of the DCs to your own domain and also the search string (Smith) to make it work in your situation. Click Preview button.

    SSIS ADO NET Source Editor with LDAP Query

  12. Once you clicked Preview button, You should see the first 200 rows.

    Preview of LDAP Query in SSIS

That’s all there is to it.

Of course, there’s a caveat of using this as you can only view the first 200 rows of your result. This is not intended to be used as a solution of any deployment other than a workaround when you are limited with what you can access and you need to find a few records from your LDAP/Domain Services.

January 7, 2022 Filed Under: How To Tagged With: ActiveDirectory, ETL, Microsoft, SSIS

How to Fix Failed to Decrypt Protected XML Node Error in SSIS

One morning, you discovered your SSIS package failed to run with the following error message:

Started: 5:00:03 AM
Error: 2021-10-08 05:00:04.62
Code: 0xC0016016
Source: SSIS_Package_ITNota
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error

This is typically caused by a simple setting that is too often overlooked during deployment.

In general, you do not want to save any connection ID and password in your package so you can inject the value from variables that you store either in a database or if you use a Package Deployment Model, then in an XML saved in the *.dtsConfig file.

So what you want to do before you build the package for PROD deployment, you want to set the package property Protection Level to DontSaveSensitive and you set all the values for your variables in your configuration file.

Steps to Set SSIS Package Property Level

  1. With your SSIS package opened, under the Control Flow tab, on a blank area, right-click your mouse and select Properties or press ALT+ENTER.

  2. Under Properties, go to Security, and look for ProtectionLevel. Check the value. By default, it’s set to EncryptSensitiveWithUserKey.

    SSIS Package Properties under Control Flow Tab

    The ProtectionLevel should be set to DontSaveSensitive.

    SSIS Package Properties Security Protection Level

Save the package and if the configuration is already setup, it’s ready to be deployed.

Further Reading

Failed to decrypt protected XML node “DTS:Password” with error 0x8009000B “Key not valid for use in specified state”

November 1, 2021 Filed Under: How To Tagged With: ETL, Microsoft, SSIS

Gotcha in Executing SSIS from DTExec Command Line

This issue was found in a troubleshooting session in one batch job with one company. The company runs its SSIS using a third party enterprise software by calling dtexec command prompt utility (dtexec.exe) and passes the arguments from its interface.

The enterprise suite calls the SSIS package using an Active Directory account (DOMAIN\BatchJob) and the SSIS package is comprised of a *.dtsx and *.dtsConfig files (using legacy deployment model).

The *.dtsConfig contains the following:

<?xml version="1.0"?>
<DTSConfiguration>
  <DTSConfigurationHeading>
    <DTSConfigurationFileInfo GeneratedBy="DOMAIN\OriginalCreatorNTID" GeneratedFromPackageName="DTS_Name" GeneratedFromPackageID="{GUID}" GeneratedDate="3/31/2021 10:00:00 AM"/>
  </DTSConfigurationHeading>
  <Configuration ConfiguredType="Property" Path="\Package.Connections[CM_ADO_MyDB].Properties[ConnectionString]" ValueType="String">
    <ConfiguredValue>Data Source=DB-SERVER;Initial Catalog=ITNotaDB;Integrated Security=True;</ConfiguredValue>
  </Configuration>
  ...

Without revealing much of the enterprise application suite (since it’s irrelevant), the application has a box command to run to call on the dtexec.exe with another box to pass in arguments such as the following:

/FILE "D:\Temp\ITNotaSSISJob.dtsx" /CONNECTION "CM_ADO_MyDB";"Data Source=DB-SERVER;User ID=MyNTID;Password=*****;Initial Catalog=ITNotaDB;Application Name=SSIS-DTS_Name-{GUID}CM_ADO_MyDB;" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EWCDI

This can be easily replicated in the Command Prompt by typing the following:

C:\>"D:\Program Files (x86)\Microsoft SQL Server\###\DTS\Binn\dtexec.exe" /FILE "D:\Temp\ITNotaSSISJob.dtsx" /CONNECTION "CM_ADO_MyDB";"Data Source=DB-SERVER;User ID=MyNTID;Password=*****;Initial Catalog=ITNotaDB;Application Name=SSIS-DTS_Name-{GUID}CM_ADO_MyDB;" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EWCDI

What happened then the job could not run because of the following error:

Error: 2021-03-31 11:20:32.54
Code: 0xC0208449
Source: DFT_***** [19]
Description: ADO NET Source has failed to acquire the connection {GUID} with the following error message: "Cannot open database "ITNotaDB" requested by the login. The login failed.
Login failed for user 'DOMAIN\BatchJob'.".
End Error

This is interesting because the assumption was that the user id that was used to login to the database would be MyNTID, which was passed as an argument. But what was really happening is that the service account NTID used to run the dtexec (whether it’s being called from a third party of the command prompt) is the one used as the database login. So what happened?

When you look at the two configuration settings, the assumption is during runtime, the argument that is passed from the command line would be the one that takes precedence over the configuration in the *.dtsConfig file. It turned out that is not the case. The setting from *.dtsConfig file is the one that takes precedence.

For a complete explanation, please read Understanding How Package Configurations Are Applied at Run Time. The most important part is quoted below:

The way in which the dtexec utility applies configurations affects the following command-line options:

You can use the /Connection or /Set option at run time to load package configurations from a location other than the location that you specified at design time.

You can use the /ConfigFile option to load additional configurations that you did not specify at design time.

However, these command-line options do have some restrictions:

You cannot use the /Set or the /Connection option to override single values that are also set by a configuration.

You cannot use the /ConfigFile option to load configurations that replace the configurations that you specified at design time.

So when there are configurations set in the *.dtsConfig file, it takes precedence over the argument passed from the command line.

Once we got this figured out, the client had to decide whether to remove the *.dtsConfig file or remove the injecting of parameters from the argument box (recommended) but grant an appropriate rights (e.g., dbo) to the service account (DOMAIN\BatchJob).

Further Reading

Run an SSIS package from the command prompt with DTExec.exe
Legacy Package Deployment (SSIS)
How to Create SSIS Package Using Visual Studio
How to Fix Failed to Decrypt Protected XML Node Error in SSIS

April 1, 2021 Filed Under: Tips and Tricks Tagged With: ETL, Microsoft, SSIS

How to Add Custom Logging to SSIS Package

This post will demonstrate one way to add custom logging to SSIS Package. This is still considered one of the better practice that comes in handy when we need to troubleshoot SSIS packages and track progress.

There’s no better way to explain the concept other than giving a simple case example on how to add it to a real SSIS package.

For starter, the package in this example does a simple data load from LDAP table to a SQL Server table with some minimal check done with a Script Component.

Setup Global Variables for Logging

Before we do anything else, it’s recommended to setup a few global variables that we can use to keep track of the log variables.

Setup global variables for the log folder and filename with a prefix of gv for Global Variable. The use of prefix is very handy since all those global variables will be sorted nicely and will be easy to find during troubleshooting.

SSIS Global Variables setup
*One of the global variable is made up with an expression to dynamically name the log file according to today’s date.

@[Log::gv_RootPath] + "\\" +  @[Log::gv_LogDir] + "\\" + REPLACE(@[Log::gv_LogFileName], ".log", "") + "-" + SUBSTRING((DT_STR, 50, 1252) GETDATE(), 1, 10) + ".log"

Setup Log File Connection Manager

We are going to write the log to a text file, so create a new connection manager by selecting New Flat File Connection… and name it CM_FF_DST_Log.

Add new Flat File Connection Manager for SSIS Logging

It’s not too important what you want to name the file, because we want to use a dynamic file name based on the date that we’ve already setup with gv_LogFile global variable. Once, it’s setup you can do a right-click on the CM_FF_DST_Log and check on the Properties.

Expand the Expressions and click on the ellipsis in ConnectionString, an Expression Builder window will be opened.

Expand the Variables and Parameters and double-click on the Log::gv_LogFile so it will go to the Expression: box and click OK.

SSIS Connection Manager Properties Expression Builder

Now, when you double-click on the CM_FF_DST_Log connection manager, the log filename will be dynamically populated according to today’s date (see File: below). You can close the window by clicking OK or Cancel as we do not need to modify this setup further.

SSIS File Connection Manager Editor Create File for Logging

Enable SSIS Logging

We finished the connection manager for the log file, but we still need to enable SSIS Logging and associate that with the log connection manager. In order to do this, go to the top menu and click on SSIS and select Logging… as shown below.

SSIS Logging menu

You will next see a new Configure SSIS Logs window. Make sure all checkboxes under the Containers are checked. We also need to make sure that on the right pane of that window, under Details we check at least OnError, OnTaskFailed, and OnWarning.

Important: Make sure this step is done for each container listed on the left side (yes, it’s tedious, but fortunately you only need to set this up once per project).

SSIS Configure SSIS Logs Details

Go to the Providers and Logs, now we want to setup the log provider to use the flat file connection manager CM_FF_DST_Log. If you setup the connection manager correctly, CM_FF_DST_Log should be available on the Configuration drop-down list. This part also needs to be done for each container.

SSIS configure logs with Flat File Connection Managers as the provider

Once this setup is complete, we’re ready to add our log in SSIS workflow.

Write the Log

Try to put the tasks within containers for each task you want to add log to.

SSIS Package Database Load

If you double-click on the SCR Log Start and click on the Edit Script…, here’s the C# script contained in the task:

SCR Log Start

public void Main()
{
  Dts.Log("Package starting...", 99, null);

  foreach(Variable v in Dts.Variables)
  {
    Dts.Log("Name: " + v.Name, 99, null);
    Dts.Log("Value: " + v.Value.ToString(), 99, null);
  }
 
  Dts.TaskResult = (int)ScriptResults.Success;
}

Data Flow Counters

Under the Data Flow tab, you can see that from each data source, there’s a Row Count component that is attached to it. In this process, the values from the Row Count component will be passed on to the global variables we setup. In this example, they are gvCNT_LDAPRowCount and gvCNT_LDAPRowCountBlanks.

SSIS Row Count Component to Global Variable

And we include a detailed count of each count and grand total in a Script Task called SCR LDAP Row Counts. Just make sure we also include the global variables in the ReadOnlyVariables like so, then click on the Edit Script….

SSIS Assign to Global Variables with Script Task

Add the calculation logic and write to the log.

public void Main()
{
  // Get LDAP row count with sAMAccountName row counts
  int rowLDAPCount = (int)Dts.Variables["CNT::gvCNT_LDAPRowCount"].Value;
 
  // Get LDAP row count that are blank
  int rowLDAPBlanks = (int)Dts.Variables["CNT::gvCNT_LDAPRowCountBlanks"].Value;
 
  // Total rows
  int rowTotalLDAPCount = 0;
  rowTotalLDAPCount = rowLDAPCount + rowLDAPBlanks;
 
  // Log if LDAP has no records.
  if (rowTotalLDAPCount > 0)
  {
    Dts.Log(String.Format(" Total records with NT ID accounts: {0}", rowLDAPCount.ToString("###,###,###")), 99, null);
    Dts.Log(String.Format(" Total records without NT ID accounts: {0}", rowLDAPBlanks.ToString("###,###,###")), 99, null);
    Dts.Log(String.Format(" Total records from LDAP source: {0}", rowTotalLDAPCount.ToString("###,###,###")), 99, null);
  } else
  {
    Dts.Log(String.Format(" No record is found in LDAP source. {0}", rowTotalLDAPCount.ToString("###,###,###")), 99, null);
  }
  
  Dts.TaskResult = (int)ScriptResults.Success;
}

At the end of the process flow, just add another script SCR Log Finish to indicate the end of the logging session after the package run.

SCR Log Finish

public void Main()
{
  Dts.Log("~ Log Cleanup Package completed. ~", 99, null);
 
  Dts.TaskResult = (int)ScriptResults.Success;
}

So what does the log file look like? Here’s an example what’s reported. It’s probably easier to read if you look at the raw file instead.

#Fields: event,computer,operator,source,sourceid,executionid,starttime,endtime,datacode,databytes,message
PackageStart,ITNOTA-SERVER,ITNOTA\UserId,SSIS-ITNota,{GUID1},{MACHINEGUID},3/5/2019 3:40:08 AM,3/5/2019 3:40:08 AM,0,0x,Beginning of package execution.

User:ScriptTaskLogEntry,ITNOTA-SERVER,ITNOTA\UserId,SCR_LogStart,{GUID2},{MACHINEGUID},3/5/2019 3:40:08 AM,3/5/2019 3:40:08 AM,99,(null),Package starting...
User:ScriptTaskLogEntry,ITNOTA-SERVER,ITNOTA\UserId,SCR LDAP Row Counts,{GUID3},{MACHINEGUID},3/5/2019 3:41:07 AM,3/5/2019 3:41:07 AM,99,(null), Total records with NT ID accounts: 11,236
User:ScriptTaskLogEntry,ITNOTA-SERVER,ITNOTA\UserId,SCR LDAP Row Counts,{GUID3},{MACHINEGUID},3/5/2019 3:41:07 AM,3/5/2019 3:41:07 AM,99,(null), Total records without NT ID accounts: 10,009
User:ScriptTaskLogEntry,ITNOTA-SERVER,ITNOTA\UserId,SCR LDAP Row Counts,{GUID3},{MACHINEGUID},3/5/2019 3:41:07 AM,3/5/2019 3:41:07 AM,99,(null), Total records from LDAP source: 21,245
User:ScriptTaskLogEntry,ITNOTA-SERVER,ITNOTA\UserId,SCR Log Finish,{GUID4},{MACHINEGUID},3/5/2019 3:41:07 AM,3/5/2019 3:41:07 AM,99,(null),~ Log Cleanup Package completed. ~
PackageEnd,ITNOTA-SERVER,ITNOTA\UserId,SSIS-ITNota,{GUID1},{MACHINEGUID},3/5/2019 3:41:07 AM,3/5/2019 3:41:07 AM,0,0x,End of package execution.

That’s all there is to it to add a custom logging to SSIS package.

This may look like a lot of work initially, but as your SSIS package grows in complexity it will save you so much time in diagnosis and troubleshooting that you will thank yourself later.

Hope it helps.

Further Reading

SSIS Best Practice with Naming Conventions
How to Create SSIS Package in Visual Studio 2017
How to Build SSIS Package for Different SQL Server Version with Visual Studio 2017 and SSDT

March 7, 2019 Filed Under: How To Tagged With: ETL, Microsoft, SSIS

Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure