December 25, 2010 at 4:51 pm
Thank you great Helpers,
--this item was misposted, answer is found below.
written a c# trigger, got it running and it appears to work as expected.
It keeps track of a changelog.
It is allmost written independent of the table for which it has been written.
The only statement that is dependent is the TableName - that should appear in the changelog.
Looking around, I saw code to get that TableName like:
SqlCommand cmd = new SqlCommand("SELECT object_name(resource_associated_entity_id) FROM sys.dm_tran_locks WHERE request_session_id = @@spid and resource_type = 'OBJECT'", conn);
I tried this, but it appears not to work as generic as I would like.
I also tried to look into the TriggerContext, but I was not succesfull.
Who has the generic clue ?
Thank you in advance,
Edmond de Savornin Lohman
Utrecht, Netherlands
use @@SPID, access the system views.
December 26, 2010 at 9:09 am
I'm curious... what does such a trigger do?
--Jeff Moden
Change is inevitable... Change for the better is not.
December 26, 2010 at 6:08 pm
Jeff Moden (12/26/2010)
I'm curious... what does such a trigger do?
The idea is usually to write a CLR trigger which can be attached to many objects, auditing the same information for each. Unfortunately, limitations of the current design make this hard to do reliably, as the author of this thread is discovering.
Jango, consider voting for Adam Machanic's Connect item here:
December 26, 2010 at 7:06 pm
SQLkiwi (12/26/2010)
Jeff Moden (12/26/2010)
I'm curious... what does such a trigger do?The idea is usually to write a CLR trigger which can be attached to many objects, auditing the same information for each. Unfortunately, limitations of the current design make this hard to do reliably, as the author of this thread is discovering.
Jango, consider voting for Adam Machanic's Connect item here:
Other than the commonality you speak of, is there an advantage to using a CLR over "standard" triggers?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply