Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to trace who inserted a particular record?

Status
Not open for further replies.

jason1972

Programmer
Feb 18, 2001
5
PH
How do I get the user name or host name that inserted or updated a particular record? Is this information stored in the database's log file, hidden fields, or anywhere else? I know I can add a user_name field and use triggers, but I need the information for records already existing in the table. Thanks.

Jason
 
It deppends on configuration and database's structure/realisation.
 
As far as I know, there is not a way of getting the user name/host name that inserted or updated a particular record unless it has been programmed to save this data. We tend to have several columns on our tables for such data as RecordsCreatedOn, RecordCreatedBy, LastUpdatedOn and LastUpdatedBy etc.

Hope This Helps,

Chris Dukes
 
We also have added fields to certain tables --Initial entry by and Last modified by.

To get host name: host_name()
To get user name: suser_sname()
 
Thanks to everyone for replying. Someone in another forum suggested the Lumigent Log Explorer. I haven't tried it out yet, but it seems to be able to retrieve user id's (and a bunch of other information) from the log file.

I wonder how these people figure out the log file format. Trial and error? Or does Microsoft publish the format?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top