Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313

    Unanswered: which table does a trigger belong to?

    Is there any way to determine which table a trigger belongs to by querying only the system tables?

    I was hoping for something like a parent_id column in sysobjects, but there is no such column.

    I am using ASE 15.0

  2. #2
    Join Date
    Mar 2007
    Posts
    29
    Hi,
    According to my understanding(Correct me if i am wrong), we don't have system table for triggers specifically ,to identify which table it belong to.

    But We have another way to find it out using the sysobjects table.

    In sysobjects table there is a field 'deltrig' which will tell us the id of the table to which the trigger belong to.

    For example..

    Try this query...

    select name from sysobjects where id = (select deltrig from sysobjects where type='TR' and name = 'TRI_INSERT'(trigger name))

    I hope this will help You.

    Regards,
    Shiya

  3. #3
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    yes, that helps a lot!

    however I've got a follow up: does this mean you can only have a maximum of one trigger of each type in sybase? that is, one insert trigger, one delete, one update?

    In SQL Server and other RDBMS you can have more. but with this design of sysobjects, it's unclear how you would represent more than one of a given type on a table.

    Thanks!

  4. #4
    Join Date
    Feb 2007
    Location
    Chennai, TN
    Posts
    68
    Hi,
    sybase have some restrictions on triggers. u can have only maximum of three triggers for a table. refer the below link

    http://manuals.sybase.com/onlinebook...asg1250e/sqlug

    Check in chapter 16. Rules Associated with triggers

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    perfect, thanks!

Posting Permissions

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