I have been studying and taking practice tests online and have a question that I am completely stuck on. I am familiar with the topic, but the way that the question is set up confuses me.
Basically the objective of this question is: If the update statement fails, rollback the transaction, otherwise commit it. Here is a bit of code it already provides and you basically have to fill in the blanks.
DECLARE @RowsUpdated int = 10
_______ NumberUpdate
UPDATE .......
SET.......
IF @RowsUpdated = AmountofRowsUpdated from query above
____
______ NumberUpdate
_____
ELSE
______
______ NumberUpdate
What I don't understand is the NumberUpdate and what goes before that?
I thought it would just be
IF @RowsUpdated = Numberofrowsaffected by query above
COMMIT TRAN
ELSE
ROLLBACK TRAN
Hopefully this makes somewhat sense, would anyone be able to explain this to me?
Thanks!
Aucun commentaire:
Enregistrer un commentaire