When I run the following in Query Analyzer:
SET QUOTED_IDENTIFIER OFF -- allows double quotes (") used as wrapper for dynamic sql.
DECLARE @E int
BEGIN TRAN T1
PRINT 'Start...'
EXEC("
begin tran T2|
raiserror( ' inside proc', 16, 11)
PRINT STR(@@ERROR)
rollback tran T2
PRINT STR(@@ERROR)
return")
SET
@E = @@ERRORIF @E <> 0
BEGIN
ENDPRINT 'Error ' + LTRIM(STR(@E)) + ' out of here...' ROLLBACK TRAN T1 RETURN
COMMIT
TRAN T1I get the following output and error:
Start...
Msg 50000, Level 16, State 11, Line 3
inside proc
50000
Msg 6401, Level 16, State 1, Line 5
Cannot roll back T2. No transaction or savepoint of that name was found.
6401
Msg 266, Level 16, State 2, Line 7
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 2.
Error 266 out of here...
Anyone have an idea why I would get the 6401 and 266 error
JD
Waleska, GA
MSBassSingerNO-SPAM@alltel.NO-SPAMnet
(just remove the string NO-SPAM)