|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, April 12, 2013 4:35 AM
Points: 6,
Visits: 229
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, October 07, 2008 2:28 AM
Points: 7,
Visits: 15
|
|
This is exactly why I use this site. Simple clear solutions that genuinely add some value to the products I develop. Although, I had to rename the objects (BlameMeTrigger and BlameMeLog). I think this will convey my intentions clearly enough ;¬).
I look forward to the next installment.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, December 02, 2008 9:36 AM
Points: 5,
Visits: 13
|
|
Hi,
I surly join the post saying that this site is the best!.
Though - i have a question - anyone investigated the DB performance issue? My concern is that if I will use the solution detailed here in a DB that is widely used, the DDL will affect the DB response time.
What do you think?
Uzi
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, April 28, 2009 6:22 AM
Points: 8,
Visits: 63
|
|
| I upgraded my SQL2000 to SQL2005 and all of the triggers were fine after the upgrade. Then my vendor provided an upgrade to the ERP which blew away a couple of the triggers on a custom table I had in the database. This has happened before. I simply re-created the triggers as I had done before when we were on SQL2000. Except now, on SQL2005, the triggers won't work. I am creating them in SSMS, logged on as 'sa'. The error message that the user gets is that she is not able to access the server. I've certainly experienced permission problems when I create SSIS packages. Could this be the same kind of problem? I find it difficult to figure out what is wrong with triggers. Any ideas about what I can do?
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 12:15 PM
Points: 1,443,
Visits: 711
|
|
David, Excellent article - concise and to the point! Well done!
Mark
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 23, 2013 12:18 PM
Points: 1,103,
Visits: 1,781
|
|
Something to keep in mind ... the connection making a change, has to have access to the audit table. That and unless you want to create an audit table per database, it's usually best to use a central table per server.
Check the attached for a script that will push the trigger to all databases. The trigger is more or less the same, but also catches the application. Change the @LoggingDBName to whatever you use for your central DBA/Logging/Admin database.
As stated though, make sure your logins have write access to the changelog table.
--
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, July 30, 2010 9:23 AM
Points: 9,
Visits: 20
|
|
In my environment I have 20 databases that are constantly updated 24 hours a day. The application uses one user account so my question has two parts.
1. Can I exclude this user from the trigger?
2. With changes being made constantly is there a way to keep the table size down?
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 11:41 AM
Points: 675,
Visits: 426
|
|
Steven Mann (10/2/2008) In my environment I have 20 databases that are constantly updated 24 hours a day. The application uses one user account so my question has two parts.
1. Can I exclude this user from the trigger?
2. With changes being made constantly is there a way to keep the table size down?
1) In your trigger you can check the login name
SET @loginname = @data.value('(/EVENT_INSTANCE/LoginName)[1]', 'NVARCHAR(100)') ....
IF @loginname != 'appuser' BEGIN -- do the work END
2) You can implement a job that does cleanup on a regular basis.
We just recently implemented this in our three main databases for one of our applications, logging to a central table (yes Adam, user has the rights =) ) just in our dev environment (we have a strict dev->qa->production process so we really just need to identify/validate which objects need to be pushed for a release). We have not had an opportunity to use it just yet, but seems to be working fine with the testing we have done.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 02, 2013 1:48 AM
Points: 1,252,
Visits: 3,367
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:15 AM
Points: 1,352,
Visits: 1,738
|
|
David, Thanks for the elegant trigger, perfect for keeping an eye on those rogue developers! (like me -- hey, wait a minute ...) ;)
|
|
|
|