|
If an error occurs in a storage, the statement behind this storage must be aborted. How do I write it?
CREATE PROCEDURE OnlineUpdateData
@UserName VARCHAR (50),
@ContractID UNIQUEIDENTIFIER,
@ErrMessage BIT OUTPUT,
@RollBackFalg INT OUTPUT
AS
----- Update MST_AirlineId and FraeGoupID
UPDATE OnlineTempTable
SET MST_AirlineId = dbo.GetAirlineIDByAirCode (OAIR), FraeGoupID = dbo.GetFBGroupID (FB, @ ContractID)
WHERE Operator = @UserName --AND Error <> 'N'
IF @@ ERROR <> 0 SET @ RollBackFalg = 1
--- Return when there is an error in this statement, how to write it, I just set RollBackFalg = 1, then return to the storage that calls this storage, and then rollback according to RollBackFalg
INSERT INTO .......
Go
Thank you! |
|