|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 5:43 AM
Points: 4,
Visits: 5
|
|
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.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:48 AM
Points: 1,076,
Visits: 1,922
|
|
pallab.santra1987 (1/24/2013) 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. 
Seriously ?
- Divine Flame
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 5:43 AM
Points: 4,
Visits: 5
|
|
Divine Flame
Yes Seriously.
I want a query(Delete) which works on nolock data of a lock table.
If you have any idea .. please Help...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:48 AM
Points: 1,076,
Visits: 1,922
|
|
Okay, jokes apart. I think you want to delete the data from a table which is already locked as some other query is doing some modification in that table.
If that is the case, you will not be able to delete the data from the table untill the first transaction is not complete. This is required to ensure data consistency & integrity as per the ACID property.
If you are facing excessive locking then you need to look for the queries that are involved in locking & optimize them.
Note: NOLOCK can't be used with DML operations such as INSERT, UPDATE & DELETE. Apart from that it should be avoided in SELECT statements too, as it actully enables dirty reads (you can read the data which is not-commited & even can be rolled back later by the transaction.)
- Divine Flame
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
|
|
check with sp_who2 , which spid is locking that table
then for all fetched do dbcc inputbuffer(sp_id), see what kind of transaction is there then decide which spid you can kill (CAREFULLY) or wait for the transactions to get completed
-------Bhuvnesh---------- While 1 = 1 (Learning SQL....) Click to get fast response of your post
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 4:11 PM
Points: 37,741,
Visits: 30,020
|
|
Wait until whatever is using the rows has finished and the locks are released. If there's an orphaned transaction locking the rows, check with DBCC OpenTran and investigate whether or not to kill the session involved.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 5:43 AM
Points: 4,
Visits: 5
|
|
| THANKS @ALL... for your valuable reply...
|
|
|
|