Category: SQL Interview Questions
SQL Server Interview Questions
What is the use of @@TRANCOUNT in SQL Server?
Returns the number of active transactions for the current connection. PRINT @@TRANCOUNT — The BEGIN TRAN statement will increment the
What is trigger in sql server?
Triggers allows us to execute a batch of SQL code when either an insert, update or delete command is executed

Difference between temporary table and table variable in sql server
Difference between temporary table and table variable in sql server Table variable Temporary table You can use it in User

003. Find Most Expensive Stored Procedure Sql Server
Problem: An important step in optimizing a system is to take a holistic approach and look at stored procedures that

135. Remove Cross duplicate rows in SQL SERVER
Remove Cross duplicate rows in SQL Server Hello friends, I got one question from my friend who recently appeared for

004. Find most expensive queries-Sql Server
———********* Most expensive queries starts****** ———— SELECT TOP 10 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset

008. Find redundant indexes Sql Server
————****** Script to find redundant indexes *********——- ;WITH MyDuplicate AS (SELECT Sch.[name] AS SchemaName, Obj.[name] AS TableName, Idx.[name] AS

001. Select Primary Key value from Table dynamically-Sql Server
Select Primary Key value from Table dynamically Hello friends, Today I am going to teach select primary key value from

005. Find most expensive tables-Sql Server
—– ************ Find most expensive tables Starts ****** ————– Select Object_Name(ix.[object_id]) as objectName , Sum(ddius.user_seeks) As ‘table_seeks’ , Sum(ddius.user_scans)

Should we Shrink database – Sql Server
Should we Shrink database – Sql Server Lets try to understand with an example. First we will create database and