Database Transaction lock information

Transaction lock

View the Transaction lock complete information using the following TSQL code.

select * 
FROM    sys.dm_tran_locks TL
LEFT JOIN sys.partitions SP 
ON SP.hobt_id = TL.resource_associated_entity_id
LEFT JOIN sys.objects O 
ON O.object_id = SP.object_id
LEFT JOIN sys.dm_exec_sessions S 
ON S.session_id = TL.request_session_id
LEFT JOIN sys.dm_tran_session_transactions ST 
ON S.session_id = ST.session_id
LEFT JOIN sys.dm_tran_active_transactions AT 
ON ST.transaction_id = AT.transaction_id
LEFT JOIN sys.dm_exec_connections C 
ON C.session_id = S.session_id
Database Transaction lock information was last modified: October 1st, 2017 by Justin Antony

What is Query Execution Plan in SQL ?

Query Execution Plan

The TSQL Query tells SQL Server what you want but does not tell it how to do.
The first thing performed on the submitted query is parsing and optimization.
Now it generates an execution plan.
The Execution plan which generated by query optimizer tells the SQL Engine how to execute the query
This plan is used to troubleshoot any performance issue by a query
The query has logical and physical processing stages, which helps to understand the flow.

What is Query Execution Plan in SQL ? was last modified: October 1st, 2017 by Justin Antony

How to create a stored procedure in TSQL ?

stored procedure creation
We can create the SP using following syntax

CREATE PROCEDURE PROCEDURENAME
AS BEGIN

// Here you can have set of SQL Statements
// Note you can have only one select statement at the end of the procedure which will return the result values.

END

How to create a stored procedure in TSQL ? was last modified: October 1st, 2017 by Justin Antony