Time:11-10
CodePudding user response:
ALTER the TRIGGER [dbo] [UpDate_GG] ON [dbo]. [they] FOR UPDATE If the UPDATE ([number]) The update T1 set T1. [number]=T1. [number] + inserted. [number] from T1, inserted where T1. [number]=inserted. [number]
ALTER the TRIGGER [dbo] [UpDate_GG] ON [dbo]. [they] FOR UPDATE If the UPDATE ([number]) The update T1 set T1. [number]=T1. [number] + inserted. [number] from T1, inserted where T1. [number]=inserted. [number] GG table for a trigger. Probably is this meaning.
- the original from https://blog.csdn.net/laizhixue/article/details/100729016 - open transaction The begin tran - error capture mechanism, look good, there are also some, and can be nested, Begin the try - statement right Insert into mattress (Eat, Play, Numb) values (' pork ', 'football', 1) Error - Numb for int type, Insert into mattress (Eat, Play, Numb) values (' pork ', 'football', 'ABC') - statement right Insert into mattress (Eat, Play, Numb) values (' dog ', 'basketball', 2) End the try The begin catch Select Error_number () as ErrorNumber, -- error code Error_severity () as ErrorSeverity, -- error severity levels, level is less than 10 try catch catch less than Error_state () as ErrorState, -- error status code Error_Procedure () as ErrorProcedure, the name of the stored procedure or trigger - errors, Error_line () as ErrorLine, the number of rows in the error - Error_message () as ErrorMessage - the details of the error If (@ @ trancount> 0) - global variable @ @ trancount, affairs open this value + 1, he is used to determine a open transaction The rollback tran - due to an error, here to roll back to start, the first statement didn't insert success, End the catch If (@ @ trancount> 0) Commit tran - if successful mattress in the table, there will be three data, - the table itself is empty table, ID, Numb for int type, the other for nvarchar type Select * from mattress
Page link:https//www.codepudding.com/database/79731.html