-
The specific steps are as follows:
1. First of all, create a trigger, which requires an update trigger to be created on the addtable table, as shown in the following figure, and then go to the next step.
3. Next, change the data in the addtable table as shown in the following figure, and then proceed to the next step.
4. Then, after completing the above steps, you will find that the trigger is triggered and the text of the setting is output, as shown in the image below, and then enter the next step.
5. Subsequently, you only need to change create to alter, and then modify the logic, as shown in the following figure, and then enter the next step.
7. Finally, another test is performed to change the addtable table and it is found that after the update trigger is triggered, it is aborted due to data protection, as shown in the image below. In this way, the problem is solved.
-
select @inta=(value you want) from inserted (the inserted table is a backup of the data before the update) if (@abcd-@inta) @inta > else
-
update is to delete first, and then insert to compare the inserted and deleted values.
-
You can understand the update action in 2 steps, first delete, and then insert
So, the previous value is in deleted.
The last value is in inserted.
create trigger t_atdatestate_update
on list
for update
asif update(atdatestate)
begindeclare @b atdatestate nvarchar(200) - before the modification.
declare @s atdatestate nvarchar(200) - modified.
declare @s_id int
select @s atdatestate= atdatestate from inserted -- Get the modified state from the updated replica table (temporary table).
select @s id=id,@b atdatestate=atdatestate from deleted -- Get the original value from the temporarily deleted table.
if @s_atdatestate is null
beginset @s_atdatestate='0'
endif @b_atdatestate is null
beginset @b_atdatestate='0'
end--If it was 2,3,4 before the modification, the state is lowered Modify down and The modified state is not the same as before the modification.
if ((convert(int,@b_atdatestate)>=2 and convert(int,@s_atdatestate)@s_atdatestate))
begininsert into ,before_atdatestate,after_atdatestate,o_ip,o_type)
values(@s_id,@b_atdatestate,@s_atdatestate,'','The state is not normal, and it is lowered downward')
endif(convert(int,@b_atdatestate)<2) and ( convert(int,@s_atdatestate)>=2)
begininsert into ,before_atdatestate,after_atdatestate,o_ip,o_type)
values(@s_id,@b_atdatestate,@s_atdatestate,'','Elevated status')
endend
In the case of sqlserver, you can write a database-based trigger in which you can get the name of the table to be operated on, and sqlserver prohibits the user from deleting the specified table. >>>More
In the deleted table of the trigger, the deleted row is saved. Just take it out and insert another table. >>>More
Draw a zone A and zone B, next to the zone a pokemon to return to player X, and put a hero C to return to neutral. >>>More
SD and RD are connected to the basic RS trigger.
, which are preset and zeroed, and are active low. When SD=1 and RD=0 (SD is not 0, RD is not 1, that is, the level value of the input from the outside of the two control ports respectively, because the low level is valid), regardless of the state of the input terminal D, Q=0 and Q is not =1, that is, the trigger is set to 0. >>>More
Schmidt triggers.
The main function of the differential voltage is positive feedback. >>>More