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)
 Transactions within stored procedure

Author  Topic 

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-09-19 : 11:18:13
Hello, If I use BEGIN TRAN and COMMIT TRAN within a stored procedure will the locks be removed?
CREATE PROCEDURE myproc AS
BEGIN
BEGIN TRAN
.. Locking/blocking code
COMMIT TRAN
.. Other code
END

So will the lock be released after the commit or help until the procedure finishes?
Thank you,

djj

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-09-19 : 12:32:36
Once you have committed or rolled back the transaction, the locks are removed.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-09-19 : 13:12:44
Thank you.


djj
Go to Top of Page
   

- Advertisement -