T-SQL

What is the default data type of NULL?

When a NULL value is stored in a column it’s easy to say what is the data type of it: it’s the data type of the column. This means that NULL value stored in DateTime column can be used in…
BI

Extracting Metadata from the Power BI Report File

The more and more is Power BI used everywhere it’s starting to be really painful to incorporate it in any metadata management solution. This article is a result of 10 hours investigation on how to get metadata from Power BI…
T-SQL

Using Binary Hash as an Alternate Record Key

It’s a common scenario in data processing solutions that we must import some data for further processing and we can’t dictate source format or data types used. This can complicate things, especially in the case when source data key values…
T-SQL

Using STRING_AGG() as a dynamic T-SQL generator

Concatenating strings is an essential practice in the dynamic T-SQL preparation process. A very common task is to generate multiple commands statements concatenated with UNION ALL, i.e. to calculate the number of rows in every table. The traditional way how…
DBA

OdbcPrec() and OdbcScale() functions

I have discovered these two functions accidentally when searching for something else. I was trying to find more information about them but there is nothing in the official documentation and these function can’t be found in any metadata view like…
T-SQL

Calculating average value of multiple columns

It’s an easy task to calculate the average AVG() value for all rows in one or more columns. But it starts to be a little bit more interesting when we should calculate the average value for more columns on the…
T-SQL

Having fun with square brackets

This article is just for fun. Time to time T-SQL dialect may look like little bit scary. In the example below, we will create such a monster using square brackets. We will create a sample table and remove one square…
BI

Reporting Services samples for AdventureWorks2017

AdventureWorks is the sample database for SQL Server. It is updated with every new release of SQL Server major version and you can download it from its official location. Samples for SQL Server Reporting Services were built against this database…