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 2005 Forums
 Transact-SQL (2005)
 Transaction in try catch bock

Author  Topic 

svjith
Starting Member

5 Posts

Posted - 2009-12-12 : 09:09:07
is my try catch modal bellow OK?
comment on it please...

BEGIN TRY
BEgin tran

--SELECT 1/0;
--bulk sql statements

COMMIT TRAN

END TRY

BEGIN CATCH

Rollback TRAN
print 'Catched'
END CATCH;

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-12 : 13:03:26
Yes looks right.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -