An user-defined function to convert comma separated values (CSV) to an Array (table) is always needed. I wrote one that uses a multi-character delimiter and returns not/trimmed values. The string searches for the delimiter, inserts the left slice into the resulting table and cuts the left slice from the string. […]
A T-SQL script to export the definition of a table may be used in an automation. For example when I automate an import of a data into the database, I don’t create a staging table with NVARCHAR(MAX) columns, but export the structure of the destination table as a staging table.
In this example I will compare the execution of two possible options to aggregate multiple columns. I have data columns A, B and C and I need to show the average. “CASE” is using a formula ((A + B + C) / (1, 2 or 3)), simulating the scenarios when […]
In the development process and on my playground I need a cloned database to play safely and delete in the end.
While we create the database architecture, we decide to use the special value NULL or replace it with empty string or zero. Later on the development stage we manipulate the data and when we need to aggregate, we have to keep in mind the NULL or “blank” columns. The funny […]
NULL values are special in SQL Server. They are not blanks or zeroes, but “Nothing” as they don’t take space in the database (table columns) and in the memory (variables). VBA uses the same word (Nothing) for NULL. The usage of NULL is a great discussion between developers and DBAs […]