Tips for SQL

How to find the lock table in sql 2008?

Select  
    object_name(P.object_id) as TableName, 
    resource_type, resource_description
from
    sys.dm_tran_locks L
    join sys.partitions P on L.resource_associated_entity_id = p.hobt_id

 

Other way to get the lock object

select * from sys.objects where name =’<<Table Name >>’

–You will get object id for table(2081546599

sp_lock  — it gives number of records, find out the exact number  ex. 2081546599 from the records and kill them following way

kill 53

kill 71

How to use the Link server using query?

 

Advertisement

About miteshisheth
Believe in sharing knowledge.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.