SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Unlocking the table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kapila Shrestha
Starting Member

Nepal
4 Posts

Posted - 03/25/2013 :  01:42:55  Show Profile  Reply with Quote
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

India
694 Posts

Posted - 03/25/2013 :  01:54:38  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
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

Nepal
4 Posts

Posted - 03/25/2013 :  02:29:47  Show Profile  Reply with Quote
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

India
694 Posts

Posted - 03/25/2013 :  02:41:16  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
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

Nepal
4 Posts

Posted - 03/25/2013 :  02:51:18  Show Profile  Reply with Quote
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

India
694 Posts

Posted - 03/25/2013 :  02:52:54  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
yes they can but,still you will be able to query the table using NOLOCK.
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2079 Posts

Posted - 03/25/2013 :  02:55:37  Show Profile  Visit jackv's Homepage  Reply with Quote
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

Nepal
4 Posts

Posted - 03/25/2013 :  07:44:31  Show Profile  Reply with Quote
Thanks both you for your response.I have solved my problem.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000