T-SQL

Maximum nesting level of CASE statement

Did you know that CASE statement has a maximum nesting level of 10? The same limit exists for IIF() function which is just a syntactical sugar and is internally transformed into multiple CASE statements. I have prepared two samples you…
Azure

Dynamic Data Masking in Azure SQL

Dynamic Data Masking is available for Azure SQL Database as one of the main security features. There is more on Data Masking on Microsoft Docs. I don’t want to repeat all these technical details, but rather provide you with sample…
T-SQL

APPROX_COUNT_DISTINCT()

APPROX_COUNT_DISTINCT() is nice new function announced currently to be in public preview for Azure. Being well known for Oracle users is now joining (like many other things:)) also the Microsoft world. This function is designed to provide aggregations across large…
T-SQL

Removing decimal places from number without rounding

ROUND() is well known function in SQL Server. Most of us knows only that two parameters can be user like ROUND(99,95, 2). This will do standard mathematical up/down rounding of number in first parameter for number of decimal places from…
Azure

Backup and restore database in Azure Storage Account

Creating backups of user databases from an on-premise environment to Azure Blob Storage is an easy task. You need to configure Storage Account in Azure where your database backups will be sent. Then you can reference this newly created storage…