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
 General SQL Server Forums
 New to SQL Server Programming
 Unlocking the table

Author  Topic 

Kapila Shrestha
Starting Member

4 Posts

Posted - 2013-03-25 : 01:42:55
hello all, im very new member in this forum.hope i will be success to find the answer of my query. My query is: How to unlock the table which is previously locked by the TABLOCK statement in sql server 2005?Thank u all in advance.

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2013-03-25 : 01:54:38
was the previous TABLOCK mentioned inside BEGIN TRAN and COMMIT..??If yes, that will it self release the TABLOCK
Go to Top of Page

Kapila Shrestha
Starting Member

4 Posts

Posted - 2013-03-25 : 02:29:47
Thank you so much for your response.Actually i have blocked the table with the sql query: "SELECT TICKET_ID FROM TICKET_TBL WITH (TABLOCK)"; i guess there is no need to begin tran and commit in sql server 2005. Please correct me if im wrong.
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2013-03-25 : 02:41:16
quote:
Originally posted by Kapila Shrestha

Thank you so much for your response.Actually i have blocked the table with the sql query: "SELECT TICKET_ID FROM TICKET_TBL WITH (TABLOCK)"; i guess there is no need to begin tran and commit in sql server 2005. Please correct me if im wrong.



So,you are not able to query the table now.
try using "SELECT TICKET_ID FROM TICKET WITH(NOLOCK)".
Go to Top of Page

Kapila Shrestha
Starting Member

4 Posts

Posted - 2013-03-25 : 02:51:18
thank you for your response.is the mentioned query:"SELECT TICKET_ID FROM TICKET WITH(NOLOCK)" totally released the locked table.i mean after that can another user locked the same table?
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2013-03-25 : 02:52:54
yes they can but,still you will be able to query the table using NOLOCK.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-03-25 : 02:55:37
Use the query on this post to check for currrent queries executing. http://www.sqlserver-dba.com/2012/09/sql-server-current-queries-executing-on-sql-server.html.
Take any necessary action

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

Kapila Shrestha
Starting Member

4 Posts

Posted - 2013-03-25 : 07:44:31
Thanks both you for your response.I have solved my problem.
Go to Top of Page
   

- Advertisement -