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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TRIGGER HELP

Status
Not open for further replies.

kissarmi

Programmer
Feb 14, 2002
72
US
Hi,

I would like to use a trigger with some of my tables to build some kind of audit file. I would like to keep up with certain information any time one of these tables is updated. That would be information such as user and password info, machine name from where the table is being accessed, and maybe some other system info. Can the trigger access this? How?

Thanks for any help.
 
Try the following:

CREATE TRIGGER trgAudit ON [dbo].[SourceTableName]
FOR INSERT AS

BEGIN
INSERT DestinationTableName(User,password,machine)
SELECT User, password, machine
FROM Inserted
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top