Sunday, February 26, 2012

Find columns which execute updatetriggers

Hello,

I want to find the columns which execute updatetriggers. Is there in sqlserver a way to find out?

In Oracle you can say:

SELECT COLUMN_NAME
FROM DBA_TRIGGER_COLS
WHERE TRIGGER_OWNER = 'MyOwner'
AND TRIGGER_NAME = 'JobUpdate'
AND TABLE_NAME = 'Job'
AND COLUMN_LIST = 'YES'

I tried: EXEC sp_depends "dba.JobUpdate".

This says nothing about the updatecolumns.

Can anybody help?

thanx and greetz

C Dunnink
The NetherlandsColumns which execute update triggers?

Triggers are table-specific. Not column-specific.

If you want to find tables that have triggers on them you can search the schema or the system tables.|||When you create a update trigger you can specify at the update of which column the trigger should go off. For example:

CREATE TRIGGER DBA.TestTrigger ON DBA.Test
FOR UPDATE AS
IF UPDATE(TestCol1) OR UPDATE(TestCol2)
BEGIN
NULL;
END;

Now I want to call a system-sp or do a select to get TestCol1 and TestCol2.

Is it clear now?|||Since that is logical code within the trigger, I doubt that it is available in the system tables or schema, other than doing a text search for the name of the column or the key string "UPDATE(".

No comments:

Post a Comment