Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Auditing Through Triggers


Auditing Through Triggers

Author
Message
Robert W Marda
Robert W Marda
SSC Eights!
SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)

Group: General Forum Members
Points: 984 Visits: 82
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rmarda/auditingtriggers.asp



Robert W. Marda
SQL Programmer
Ipreo

ckempste
ckempste
SSC Eights!
SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)

Group: General Forum Members
Points: 885 Visits: 1
Hi

Only problem we had is where programmers with retrieving the identity of the inserted row, but they kept retrieving the audit tables identity column instead, so we had to remove this identity column from the audit table and rely on date/time and user combination (no p-key on the audit table). Have you experienced this before?

Also, TEXT columns can not be audited unless you use INSTEAD-OF triggers which is a right pain in the you know what.

Cheers

Chris


Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
Andy Warren
Andy Warren
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: Moderators
Points: 7183 Visits: 2679
With SQL2K Scope_Identity() solves those issues - I agree it was a pain and a MAJOR source of bugs if someone added a trigger that inserted to another table with identity column after the fact. Another option is to use a unique identifier for the audit primary key if you prefer/like a contrived key.

On text cols...guess it depends how important it is! I use instead of triggers in some places, in others it is non-critical data and I just don't audit.


Andy

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
ckempste
ckempste
SSC Eights!
SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)

Group: General Forum Members
Points: 885 Visits: 1
Hi Andy

Thanks Andy, also found an article on it and will give it a burl. Ill have to be more thorough in reading up on the new features.

Cheers

Chris


Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
Robert W Marda
Robert W Marda
SSC Eights!
SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)

Group: General Forum Members
Points: 984 Visits: 82
I never had a problem with the identity columns. I think this is because we didn't use them a lot where I used to work (Telos Corporation).

Robert Marda



Robert W. Marda
SQL Programmer
Ipreo

bozo7
bozo7
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 1

The only issue I have with this approach is it makes one assumption. Each user in the organization has a network sign on. Where I currently work (today is my last day) the network admin refuses to give everyone network signons. He knows at some point we have to have auditing of changes and I have told him this is the best approach. But he refuses to do so. Since the application we developed has unique signons for each user we could do something with that but it makes it harder.

Having network signons is usually a good assumption to make but not always.

Ross





depafeo
depafeo
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1

I'm currently building a security administrator app and I have a process where when a user's info is updated, the permissions table is also updated.  I send in the UserID that is doing the update into the stored procedure. My question is can the trigger read the "Updated By UserID" param or would I have to have a column in the UserInfo table get updated by the UserID param and then the trigger would get the UserInfo:Updated By UserID column?

Thanks, Lucas





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search