Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    4

    Question Unanswered: Column List in Update trigger

    I want to create an audit trail system in my db but only on certain tables and columns. I know I can do:
    IF UPDATE(col1)
    .
    .
    IF UPDATE(col2)
    .

    etc, etc

    what I whant to do is pull in the list of updated columns from the triggering command so I can use a table to control the auditted columns.

    Does anyone know where this information is held?

    Cheers

    ps ASE 11.9.2 on RH Linux
    Last edited by wildthing; 10-18-06 at 05:33.

  2. #2
    Join Date
    Sep 2006
    Posts
    15
    You can use the trigger generated tables.

    The Inserted and Deleted table.

    If this is what you mean.

    if update(col1)
    begin
    select @col1_before_image=col1 from deleted
    select @col1_after_image=col1 from inserted
    end

    etc
    etc

  3. #3
    Join Date
    Oct 2006
    Posts
    4
    Not quite - I wanted to get away from the "IF UPDATE" senario and pull in the list of columns that were in the "SET" part of the UPDATE command. Then compare that list to a list of columns I want to track. Thanks anyway.

Posting Permissions

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