Question: How to Escape a Single Quote in SQL Server?
SQL SERVER – Query to Find the Longest Running Function – Function Elapsed Time
I love my job of SQL Server Performance Tuning and Optimization consultant as every single day I walk into the customer door (well, to be honest, it is actually virtual door of GoToMeeting), I face new challenges and learn new ways to tune SQL Server. In this blog post, we will discuss Query to Find the Longest Running Function.
SQL SERVER – Restoring SQL Server 2017 to SQL Server 2005 Using Generate Scripts
Let me answer the first question first – There is no way to backup and restore SQL Server 2017 to SQL Server 2005 with the help of any tools. In this blog post, we will learn about how we can generate scripts to achieve this task.
SQL SERVER – Simple Method to Find FIRST and LAST Day of Current Date
In my very old post SQL SERVER – Query to Find First and Last Day of Current Month – Date Function, I had explained how to find the first day and last day of the current date.
SQL SERVER – Remove Duplicate Rows Using UNION Operator
In my earlier post on SQL SERVER – Delete Duplicate Rows, I showed you a method of removing duplicate rows with the help of ROW_NUMBER() function and COMMON TABLE EXPRESSION. In this post, I am going to show you a tricky method of removing duplicate rows using traditional UNION operator.
SQL SERVER – How to Fix log_reuse_wait_desc – AVAILABILITY_REPLICA?
Earlier this week I had multiple engagements of Comprehensive Database Performance Health Check. While working with one of the customers we realized that when we query sys.databases for one of the databases, we always see column log_reuse_wait_desc containing reasons AVAILABILITY_REPLICA. The customer was really curious about what it means. Let us see what we found out after quick research.
SQL SERVER – Identifying Query Growing TempDB
During the recent Comprehensive Database Performance Health Check we observed that the size of the TempDB is very big for our customer. The first question which they asked was if there is any way they can identify query growing TempDB.



