I'm seeing something strange in Query Analyzer, and I wonder if anyone else has noticed it.
Inside a stored procedure, if I refer to a non-existent table, the proc fails--giving an error, but I'm left with an additional error message indicating that a COMMIT or ROLLBACK is missing.
Some quick steps to reproduce:
When I run the stored proc above in Query Analyzer, I get two errors: an error telling me that I typed the wrong table name, and an error telling me that I am missing a COMMIT or ROLLBACK, even though the ROLLBACK is obviously present.
However, if I alter the stored procedure code a little bit:
using the correct table name, but still generating an error, I only get the single error that I am expecting.
Has anyone else run into this situation? Any idea why it is happening?
Thanks.
Ben
Inside a stored procedure, if I refer to a non-existent table, the proc fails--giving an error, but I'm left with an additional error message indicating that a COMMIT or ROLLBACK is missing.
Some quick steps to reproduce:
Code:
CREATE TABLE [tblTest] (
[TestId] [int] NOT NULL
)
GO
CREATE Procedure spTransactionTest
(@TestInput INT)
As
BEGIN TRANSACTION
INSERT INTO tblTest1
VALUES (3)
ROLLBACK TRANSACTION
GO
When I run the stored proc above in Query Analyzer, I get two errors: an error telling me that I typed the wrong table name, and an error telling me that I am missing a COMMIT or ROLLBACK, even though the ROLLBACK is obviously present.
However, if I alter the stored procedure code a little bit:
Code:
INSERT INTO tblTest
VALUES ('wow')
Has anyone else run into this situation? Any idea why it is happening?
Thanks.
Ben