1
내 테스트 테이블은 두 개의 열이 나는 내 두 번째 쿼리는 그래서 트랜잭션이 롤백하려는 잘못된 것을 알고SQL Server 2008R2에서 트랜잭션을 ROLLBACK 할 수 없습니까?</p> <pre><code>id int not null somecolumn varchar(10)) </code></pre> <p>이제 내 쿼리 참조 :
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
'GO'를 제거하면 같은 결과가 발생합니까? – xan
BEGIN과 END 사이에 GO 키워드를 사용할 수 없습니다. [http://stackoverflow.com/questions/1180279/when-do-i-need-to-use-begin-end-blocks-and-the-go-keyword-in-sql-server] [ 1] [1] : http://stackoverflow.com/questions/1180279/when-do-i-need-to-use-begin-end-blocks-and-the-go-keyword- in-sql-server –