Saturday, 15 January 2011

sql - Get the table name where data is updated/inserted -


Is there a way to get the name of the table where the data is updated / inserted?

  Update a set a.Salary = a.Salary + 5000 to dbo.Employee an INNER JOIN dbo.Status b on a.StatusID = b.ID WHERE b.Description = 'Regular' SELECT @@ TableUpdated  

should be Ouput employee

This is a hack and can be done only inside the trigger but still you can try it and help someone get an idea:

 < Code> Trigger jade on deobo.mparity update after update (a)) (selection * FROM INFOMATION_SCHEMA.COLUMNS where TA BLE_NAME = 'Employee' and COLUMN_NAME = 'A') Select 'Employee' End ELSE // You can add more if start the statement 'Choose position' end  

Once When you create the trigger, use the question that you have provided in your question, the trigger should return you to the name o


No comments:

Post a Comment