What is Shared Lock in SQL Server.

  • Shared lock is a common lock on every object in SQL Server.
  • When you put shared lock on any object/page/extent ..etc, we can perform select operations only.

How to create shared lock on particular object:

Example:

begin tran
select * from dbo.Table_1 with (holdlock) where eno=11
select * 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