Home > database > Used to trigger 2008 home UPDATE to UPDATE fields are not fixed
Used to trigger 2008 home UPDATE to UPDATE fields are not fixed
Time:11-19
Home used 2008 trigger the UPDATE UPDATE fields are not fixed
Update the fields in the table are not fixed how to write a trigger
CodePudding user response:
Declare fields varchar (255) Remember - field assignment The Update table Set field
CodePudding user response:
To write a complete? I am on a field update, now there is a problem, update the other fields prompt implementation success, but I can't update to the data
CodePudding user response:
CREATE the TRIGGER TRIGER_YYDATA_INSERT ON YYDATA Home UPDATE AS IF the update (signno) The BEGIN DECLARE @ count INT Select @ count=count (1) the from INSERTED A where clause A.S IGNNO in (select signno from YYDATA where LEFT (APPOINT_DATE, 10)=LEFT (A.A PPOINT_DATE, 10)) IF @ count & gt; 0 The begin Raiserror (' SIGNNO REPEAT ', 16, 1) The rollback transaction END The ELSE The begin The UPDATE YYDATA SET SIGNTIME=T2 SIGNTIME, SIGNNO=T2 SIGNNO, SIGNSTATE=T2. SIGNSTATE The FROM YYDATA AS t1, inserted AS t2 WHERE t1. APPOINT_ID=t2. APPOINT_ID End END