sql server - Create Trigger for Speific Column -


trying create trigger specific column can trigger whole table work.

  create trigger nameblock on tblcustomer   insert     begin   rollback transaction   print 'name edit not allowed!'   end 

i want creates trigger if update customername done column in table

create trigger nameblock on tblcustomer update if update(name) begin   rollback transaction   raiserror('name edit not allowed!',16,1) end 

to cover commented point can use below trigger too.

create trigger nameblock on tblcustomer instead of update begin   update tblcustomer set phone=i.phone,address=i.adress    inserted inner join tblcustomer on (tblcustomer.id=i.id)   i.name=tblcustomer.name    if update(name)       print 'name edit not allowed!' end 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -