January 11, 2002 at 12:00 am
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rmarda/auditingtriggers.asp
Robert W. Marda
Billing and OSS Specialist - SQL Programmer
MCL Systems
January 13, 2002 at 8:14 pm
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"
January 14, 2002 at 5:28 am
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
January 14, 2002 at 5:15 pm
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"
January 24, 2002 at 3:54 pm
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
Billing and OSS Specialist - SQL Programmer
MCL Systems
January 16, 2004 at 6:31 am
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
January 22, 2004 at 7:51 am
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
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply