Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Arrow Unanswered: 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 Netherlands

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Columns 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.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Arrow wrong explanation

    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?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    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(".
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •