How to delete duplicate rows from a table in SQL

Duplicate records can result in unintended outcomes when working with data. Despite data professionals disliking it, this issue is often encountered in data warehouse systems. When loading data from sources…

Read more »

How to Convert Seconds to “HH:MM:SS” format in TSQL

Presenting the time/duration in HH:MM:SS format is important for good readability. There are situations where the duration of an event needs to be calculated between time intervals. The difference can…

Read more »

How to find a column is updated.

In application development, there are situations where an action is driven based on a change in data. A trigger can be used to perform an action based on the data…

Read more »

Grant permission to Integration Service Catalog folder

People often confused that having access to SSISDB will also provide access to the Integration Service Catalog folders but permission for the folder is handled separately. The following code can…

Read more »

Identifying cached tables in SQL Server buffer

When a query is submitted it goes through a sequence of phases in SQL Server. Starting from parse, optimization, plan preparation until the execution of the plan. During the execution…

Read more »

How to find the Service Account of SQL Server Service

Dynamic management views are very much useful when it comes to troubleshooting or collecting server and database related configuration information. The sys.dm_server_services provides the information about the service name and…

Read more »

How to rename column name of a table in SQL Server

The system stored procedure “sp_rename” is used for renaming user-created objects in the database. The following code is renaming the column “empdoj” to “empjoindate” in “emp” table. The first parameter…

Read more »

How to find when was SQL Server restarted?

There are few ways to find out when the SQL Server was restarted, here I am going to use DMV (sys.dm_os_sys_info) to find the SQL Server restarted time.

Read more »

How to find whether the date is end date of the month in SQL

Working with date is very interesting, I have seen people add too much code to get desired result while it can be achievable with simple logic. Below sample is to…

Read more »

How to find the Date is first day of the Week in SQL

Some time you may need to find the given date is first day of the week or not? here is the code.

Read more »