What is Update (U) lock in SQL Server.

  • The Update (U) lock is special lock to prevent the deadlock situation.
  • The query is executed by one process with select operation (Shared lock) on particular object, at the same time any other process sending the request to same object with (Exclusive lock), but it’s not allowed.
  • At this movement the for some time it will assigned the Update (U) lock .

How to create Update (U) by force:

Example:

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