sql - Get the table name where data is updated/inserted -
is there way table name data updated/inserted?
update set a.salary = a.salary + 5000 dbo.employee inner join dbo.status b on a.statusid = b.id b.description = 'regular' select @@tableupdated
ouput should employee
it's hack , can done inside trigger still can try , may idea:
create trigger z on dbo.employee after update if(update(a)) begin if exists(select * information_schema.columns table_name = 'employee' , column_name = 'a') begin select 'employee' end else // can add more if statements begin select 'status' end end
once create trigger, use update statement provided in question, trigger should return name of table.
Comments
Post a Comment