On Transact SQL language the Msg 3902 Level 16 - The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION means that the command begin tranasaction is missing.
Msg 3902 Level 16 Example:
Invalid TRANSACTION
USE tempdb;
GO
INSERT INTO dbo.departments (ID, NAME) VALUES (10, N'd1');
INSERT INTO dbo.departments (ID, NAME) VALUES (20, N'd2');
INSERT INTO dbo.departments (ID, NAME) VALUES (30, N'd3');
INSERT INTO dbo.departments (ID, NAME) VALUES (40, N'd4');
GO
COMMIT WORK;
GO
Message |
---|
Msg 3902, Level 16, State 1, Line 8 |
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. |
Correct TRANSACTION:
USE tempdb;
GO
BEGIN TRANSACTION;
GO
INSERT INTO dbo.departments (ID, NAME) VALUES (10, N'd1');
INSERT INTO dbo.departments (ID, NAME) VALUES (20, N'd2');
INSERT INTO dbo.departments (ID, NAME) VALUES (30, N'd3');
INSERT INTO dbo.departments (ID, NAME) VALUES (40, N'd4');
GO
COMMIT WORK;
GO
Other error messages:
- Specified scale is invalid
- The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name
- Table already has a primary key defined on it
- Column name does not exist in the target table or view
- Violation of PRIMARY KEY constraint
- Column names in each table must be unique
- There is already an object named in the database