Varchar<>Varchar(n)

This is a general mistake that many developers do and sometimes goes unnoticed while reviews and testing, but then suddenly one day start appearing as bugs. Many developers understand and (misinterpret) varchar as variable-length data type and hence doesn’t specify the length in the variable definitions which is incorrect. Here… Continue Reading Varchar<>Varchar(n)

GetDate() V/s GetUTCDate()

Today my colleague asked me, what is the difference between GetDate() and GetUTCDate()? and I thought it would be a nice idea to blog about it. So here it is, my next article. In simple words the GetDate() returns the local time where as GetUTCDate() returns the GMT time. GETDATE()… Continue Reading GetDate() V/s GetUTCDate()

Deterministic Functions in SQL

Deterministic functions always return the same result whenever they are called with a specific set of input values provided the database state remains unchanged. Non-deterministic functions may return different results each time they are called with a specific set of input values even if the database state remains unchanged. In another… Continue Reading Deterministic Functions in SQL

Ranking Funtions – Explained

Ranking function  help us assigning a rank value for each row in your result-set. They support the windowing the partition too. Books Online states that these functions are non-deterministic. These are the ranking functions available in SQL Server. RANK() Returns the rank of each row within a result set. The… Continue Reading Ranking Funtions – Explained

What makes a query SARGable?

What is SARGability? The word SARGable comes from the term “Search ARGumentable”. This tells if an item can be found by using an index, provided such an index is available. Understanding sargability can really impact the  ability to write well-performing queries. If a WHERE clause is not sargable, the Query Optimizer… Continue Reading What makes a query SARGable?