Design Pattern // Logging an ETL process with T-SQL

How can you judge whether an ETL process has been successful? The mere fact that a process was not terminated with an exception does not necessarily mean that the process did what was expected of it. Readable and evaluable logging of an ETL process can help here. It enables a reliable assessment of the success of an ETL process.

This article presents a design pattern for logging an ETL process based on stored procedures that insert and update log records in log tables. The aim is to create a readable and evaluable protocol that provides answers to essential questions about the execution of an ETL process:

  • How long does the ETL process take in total?
  • How long does a stored procedure, SSIS package, or other component take to execute?
  • How long does it take to execute a specific SQL statement?
  • How many records were processed by an SQL statement?

Of course, we also want to know whether the process as a whole, a procedure or even a specific SQL statement was executed successfully.

The procedure is actually straightforward: At the beginning of each action, a log data record is written and after the action is completed, it is updated with either the status success or failure and, if necessary, other helpful information. That’s it! But it can still be a little more…

Read more

SSIS vs. SQL – Readability/Maintenance -or- How much of SQL you want to have in your SSIS package?

How this articel has developed… SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find … Read more

SSIS vs. SQL – Source Code Management

Dieser Artikel in Deutsch… Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find … Read more

SSIS vs. SQL – Impersonation

Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find a bunch of good … Read more

SSIS vs. SQL

Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find a bunch of good reasons why to utilize this tool set. With Transact SQL (T-SQL) … Read more

Formatting SQL Statements (Part 2)

Dieser Artikel in Deutsch… Introduction Developing SQL code follows a completely opposed paradigm compared to developing software code. While one single SQL statement may consist of hundreds of lines, software commands tend to be rather short and compact. You use many commands for achieving a goal in software development. In SQL server it is highly … Read more

Structuring and Formatting SQL Statements

Dieser Artikel in Deutsch… Overview Recently, I had to revise a Stored Procedure with nearly 2.000 lines of code. The procedure was edited by three developers, one after another. It contained sub statements for about 30 tables with varying degrees of complexity. But essentially all Sub-Statements were designed to fulfill a similar task. While all … Read more

The Functional Aesthetics of SQL — Why Structured Code Is Faster to Edit

Anyone who has ever debugged a 200-line SELECT without indentation knows: SQL formatting is more than a matter of taste. Readable code isn’t just easier to understand — with the right editor tools, it’s also much faster to refactor. In this article: Prerequisite: SSMS serves as the example editor; the principles apply to any editor with … Read more