Thomas Mathew
Thomas Mathew

Reputation: 1151

trigger not working

I wrote a trigger for whenever an update occurs in the table. But the trigger is not executing after update. The db used is SQLServer.

create trigger mytrigger on t_emp after update
as
begin
   select * from t_emp
end

Thanks

Upvotes: 0

Views: 73

Answers (1)

gbn
gbn

Reputation: 432271

Triggers are used for further processing after UPDATEs or INSERTs etc, typically for history or audit tables, or for complex data integrity logic. Not for data retrieval. Triggers can break a lot of client code (see this on SO)

  • To get the output of what you've just updated, use the OUTPUT clause.
  • To get all rows from the table, use a second SELECT statement

Upvotes: 2

Related Questions