Create TRIGGER [dbo]. [Tr_customer_info]
on [dbo]. [T_customer_info]
After UPDATE
As
Begin
if ((((select Bank_number from inserted) <> (select Bank_number from deleted)
or ((select Mobile_phone from inserted) <> (select Mobile_phone from deleted)
or ((select email from inserted) <> (select Mail from deleted))
and SUBSTRING ((SELECT update_ip from inserted), 1,7) <> ' 192.168 ')
Rollback
End
GO
So here's the question:
The condition is: when I pass the Uat field test, the path is used for 172.21.33.45 test and the IP is stored in the UPDATE_IP of the database table T_customer_info. Modify user profile Bank_number times wrong
Result: The operation tip Error "Thetransaction ended in the trigger. The batch has been aborted. "
Cause: IP is illegal, causing data rollback.
Later instead: if (((((select Bank_number from inserted) <> (select Bank_number from deleted))
or ((select Mobile_phone from inserted) <> (select Mobile_phone from deleted)
or ((select email from inserted) <> (select Mail from deleted))
and SUBSTRING ((SELECT update_ip from inserted), 1,6) <> ' 127.21 ')
Rollback
Normal update.
Note: Such triggers can prevent database clients from operating the database, and the local area network program modifies the database. It is mainly used for important database table information in production environment.
SQL Server triggers