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 2000 Forums
 SQL Server Development (2000)
 Transaction Issue

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-12-03 : 17:31:59
BEGIN TRANSACTION s
SELECT 2

IF 1 = 1
BEGIN
ROLLBACK TRANSACTION s
END
SELECT 1
COMMIT TRANSACTION s


If I am correct I should never see the select statements, I don't think I should ever get to the SELECT 1. Anyway when I run this I get the error msg:

Server: Msg 3902, Level 16, State 1, Line 12
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

Any Ideas

slow down to move faster...

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-03 : 17:34:05
No, you'll see the SELECT statement, and the COMMIT. ROLLBACK does not terminate a batch, and since you don't have an ELSE clause, the procedure continues normally after the IF construct.

Go to Top of Page
   

- Advertisement -