Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Lock Table Problem

Author  Topic 

pallab.santra1987
Starting Member

1 Post

Posted - 2013-01-24 : 05:08:23
For SQL Server 2008:

What is the procedure to delete some data from Lock Table?
We can't use NOLOCK for Update, delete & Insert for that.

A table Name like Business_History which is in Transaction Lock.
Want to delete data where Proposal_Form_No='ABC'. If I Execute Select Operation With NOLOCK it shows 5 rows of data. But Can't delete them.

Please Help.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-24 : 08:32:26
That sounds like some other process is locking the table and not releasing it. For example, a transaction that has been left open without being committed inadvertently? Tables get locked all the time, but then they should released. sp_lock and sys.dm_tran_locks should give you some information about the locks being held
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-01-24 : 13:57:59
It's trying to obatin an Exclusive Lock, and is incompatible with whatever the current lock is.
use this query to see lock and blocking sessions - http://www.sqlserver-dba.com/2012/12/sql-server-find-sql-server-locks.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2013-01-25 : 10:55:34
You may be forced to kill the processes holding the lock.

If possible, you could rollback/commit the transaction.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-01-25 : 13:46:52
Not exactly, about your question, but putting a NOLOCK on a doesn't make any sense. Additionally, SQL will not honor that hint on a delete anyway.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-01-26 : 05:51:50
The intention is for SQL Server to use it only for INSERT and SELECT. It'll be removes in the future version

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -