-- 1
DELETE QDEB
FROM QuoteDetailExtensionBase QDEB
LEFT JOIN QuoteDetailBase QDB
ON QDEB.QuoteDetailId = QDB.QuoteDetailId
WHERE QDB.DeletionStateCode = 2
-- 2
DELETE FROM QuoteDetailBase WHERE DeletionStateCode = 2
如果第一次删除有问题,如何停止第二次删除?
我知道我需要一个交易,但正确的语法是什么?
BEGIN TRANSACTION
...
END
COMMIT
这是对的吗?
由于
答案 0 :(得分:0)
private BaseLoaderCallback mOpenCVCallBack = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status){
switch (status){
case LoaderCallbackInterface.SUCCESS:
{
RobotLog.i(TAG, "OpenCV Loaded Sucessfully");
}break;
default:
{
super.onManagerConnected(status);
}break;
}
}
};
你也可以使用, SET XACT_ABORT ,如果出现任何错误,这会回滚整个批次。所以你的删除语句可以像这样,如果出现任何错误,它们都会被回滚
begin try
begin tran
--two delete statements
commit
end try
begin catch
rollback tran
select error_message()
end catch