Use UPDATE trigger for the first time

xiaoxiao2021-03-05  22

MSSQLServer. When the AccountId, the PASSWORD update is updated, the corresponding information of the username table is automatically updated.

Design AccountId as the foreign key in the relational table, and the following is the trigger change of Password.

CREATE TRIGGER change_agent ON dbo.agentINFO for UPDATEASdeclare @password_i varchar (10) declare @accountID_d varchar (10) set @ accountID_d = (select d.accountID from Deleted as d) set @ password_i = (select i.password from Inserted as i) If Update (Password) BeginUpdate UserName Set Password = @password_i where accountid = @ Accountid_Dend

转载请注明原文地址:https://www.9cbs.com/read-36990.html

New Post(0)