我的测试表有两列:
id int not null
somecolumn varchar(10))
现在看看我的查询:
USE TRY
BEGIN TRANSACTION T1
INSERT INTO Test VALUES(7,'hi');
GO
INSERT INTO Test VALUES(8,'hi','ABC');
GO
PRINT @@ERROR
if @@ERROR>0
ROLLBACK TRANSACTION T1
ELSE
COMMIT TRANSACTION T1
我知道我的第二个查询是错误的,所以我希望事务回滚,但它插入第一个查询然后显示此消息:
(1 row(s) affected)
Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.
213