Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    KL, Malaysia
    Posts
    38

    Unanswered: Trigger Question

    Is it possible for a trigger to know the table name it belongs to programmatically?
    Save the dugongs!

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    the look up is straight forward:

    select so1.name, so2.name
    from sysobjects so1
    join sysobjects so2 on so1.parent_obj = so2.id
    where so1.id = object_id('<your trigger name here>')
    and so1.type = 'TR'

    but I am guessing that if you know the trigger name you would already have the table name?
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Jan 2003
    Location
    KL, Malaysia
    Posts
    38

    Re: Trigger Question

    Just worry if I change my table name, the trigger might not work anymore. ( using after triggers, but perform operation on the table if it satisfies certain criteria ).

    Thanks paul.
    Save the dugongs!

Posting Permissions

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