Ray*_*Ray 3 t-sql sql-server error-handling
我是SQL的新手,我正在尝试理解以下脚本.有人可以为我打破这个吗?
ErrorHandler:
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
RAISERROR('Error occurred in script to update version: transaction rolled back', 182, 4)
END
ELSE
COMMIT
Run Code Online (Sandbox Code Playgroud)
我对Java有所了解,所以我理解循环.这是我需要帮助的SQL语法.
谢谢你,雷
$var客户端脚本中的SQL等价物.在伪代码中:
if (something went wrong) {
undo all operations performed since the transaction started;
send out an error message
} else {
save the operations and commit them to disk
}
Run Code Online (Sandbox Code Playgroud)