SQL Server

Get the Iteration of a Weekday in a Month on a Virtual Calendar

There are many situations where you need to identify the iteration of a weekday within a given month. Most commonly though is for the identification of public holidays e.g., the 4th Thursday in November – Thanksgiving in USA. There are no built-in methods to get this information in any SQL-based platform I have used thus …

Get the Iteration of a Weekday in a Month on a Virtual Calendar Read More »

Dynamic SQL in Databricks and SQL Server

What is dynamic SQL? Dynamic SQL is a programming technique where you write a general purpose query and store it in a string variable, then alter key words in the string at runtime to alter the type of actions it will perform, the data it will return or the objects it will perform these actions …

Dynamic SQL in Databricks and SQL Server Read More »

Calculate Easter Sunday Dynamically using SQL

In any data warehousing or analytics solution, you will eventually need to generate a calendar table in order to perform time intelligence analytics. One key aspect that most businesses will require is to view KPIs by working days only i.e. days when the business was operating normally. Each business will have their own unique rule sets …

Calculate Easter Sunday Dynamically using SQL Read More »

Query JSON data in SQL Server and Synapse Analytics

When would you work with JSON Data? JSON is a popular data representation format used on the web to exchange information between remote parties.It is also used for storing unstructured data in log files or NoSQL Document Databases such as MongoDB or Azure CosmosDB.SQL also has the ability to store JSON data in a text …

Query JSON data in SQL Server and Synapse Analytics Read More »