Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to modify all the triggers in all the tables which have audit configuration. If the ModifiedBy is empty or NULL then we need to use the below SQL Command to get the Current User Name and fill in the ModifiedBy Column.Basically what we are trying to do Is to make sure the modifiedby and modified date get filled in when someone updates a record using SQL Maintenance studio. So we want the trigger to check if the modified by of the record being updated (not to be confused with the record you write to the audit table) and if it is empty we need to select the system_user and the current date and time and update the table.
Posted
Comments
ZurdoDev 3-Oct-13 7:40am    
This is not clear. Where are you stuck?

Hi,

You can use EvenData generated for this alteration event in DDL trigger and use it for updation on your own table.

This Article will help you in this direction..

You can know table ,database ,Table(object name),User etc.

Send Email Alert on Database Schema Change in SQL Server[^]

You need to just use update query in step 4 , to update appropriate tables with eventime and loginname.

Hope this will help you.

Regards.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900