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 »

Synonym in SQL Server

Synonym A synonym is an alias or an alternative name given to the other objects in the database. The alternative name can be used to refer to the underlying objects…

Read more »

Can TRUNCATE be rolled back in SQL Server?

A database transaction, by definition, must be atomic (it must either complete in its entirety or do not affect whatsoever), consistent, isolated, and durable. These four properties are commonly referred…

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 »

CHECKPOINT in SQL Server

CHECKPOINT is an internal SQL Server process that runs periodically to write dirty pages (changed pages) and transaction log records from memory to disk. It then marks a point in…

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 »

When did the last statistics update occur?

Statistics are the critical piece of information that SQL Server maintains for a table or index. The query optimization process depends on the statistics information to prepare an execution plan…

Read more »

DBCC HELP!!

SQL Server has many DBCC commands, administrators use them for maintenance, validation and to collect information about the database, for example, DBCC SHOW_STATISTICS displays statistics for a table. But there…

Read more »

What does CHECK OPTION do in a View

When CHECK OPTION specified in a view definition, all the data modification and insertion through the view will be forced to qualify the view’s filter criteria. I will use the…

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 »