The SQL Server add trigger does not allow data deletion. The trigger is of the insteadofdelete type. Note: The trigger of the instead type is equivalent to directly following the code in the trigger after the DELETE command is run. If there is no such trigger, this trigger will block all your DELETED commands. Instead, only the code in the trigger will be executed. If
The SQL Server add trigger does not allow data deletion. The trigger of the instead type is of the instead type. Note: The trigger of the instead type directly follows the code in the trigger after the delete command is run, if no, this trigger will block all your DELETED commands. Instead, only the code in the trigger will be executed. If
Adding a trigger to SQL server does not allow data deletion
The trigger is: instead of delete type, website space. Note: The trigger of instead type is equivalent:
After the DELETE command is run, the U.S. server directly goes through the code in the trigger and goes down. No more ......
That is to say, this trigger will block all your DELETED commands. Instead, only the code in the trigger will be executed.
If you comment out the code in this trigger, the server space is equivalent to blocking all DELETE commands.
Create trigger [dbo]. [trg_del] on [dbo]. [drv_user]
Instead of delete
AS
BEGIN
Declare @ cou int
Select @ cou = count (*) from deleted;
If (@ cou> 0)
RAISERROR ('data cannot be deleted! ', 16, 1)
END
Posted on