What is Exclusive (X) Lock in SQL Server.

  • Put exclusive (X) lock on any resource like ( page/object/extent .etc) that is exclusive to particular process only.
  • Just like a owner of that particular resource.
  • we can perform the DML (Insert,Delete, Update) operations automatically to operate on exclusive lock mode.
  • How to create or put exclusive lock (X) on particular object.
  • Example:

begin tran
update dbo.Table_1 set eno=56 where ename=’bujji’
select resource_type,request_mode,resource_description from sys.dm_tran_locks where resource_type <> ‘DATABASE’
rollback

Advertisements

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 )

Google+ photo

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

Connecting to %s