Creating Dynamic Pivot Table with QUOTENAME Function
In my previous article on the basic pivot operator, we saw how pivot operator could be used to...
Methods to Rank Rows in SQL Server: ROW_NUMBER(), RANK(), DENSE_RANK() and NTILE()
SQL Server provides us with a number of window functions that help us to perform calculations across a set of rows, without the need to...
Understanding Pivot Operator in SQL
The pivot operator in SQL Server converts each row in the aggregated result set into corresponding columns in the output set. The pivot...
Counting references to a record in a table via Foreign Keys
I have recently needed to solve the task for my own purpose: to calculate the number of external...
Introducing Common Table Expressions in SQL Server
Common Table Expressions, or CTE for short, is simply a technique to create a temporary set of records that can be referenced within an...
Introduction to Temporary Tables in SQL Server
A temporary table in SQL Server, as the name suggests, is a database table that exists temporarily on the database server. A temporary...
Why Multiple JOINs are bad for Query or Do Not Get in the Way of Optimizer
Recently, I came across an application that generated DB queries. I understand that there is...
Better ALTER than DROP
In this article, I am going to provide a construction for deleting an object before creating it....
SQL Server: The dark side of NVARCHAR
Introduction In this article, we are going to talk about using the nvarchar data type. We will explore how SQL Server stores this data type...
Tips for Read/Write Locks Depending on Transaction Isolation Level in MSSQL
Read Uncommitted If data is being changed in one transaction, selection of this data (in other...