...the SQL Query Tool that was designed with you in mind
Get Productive Today!
Home | Product Features | Screenshots | Videos | Download\Purchase | Support Forum | About

Query Your Database for Trigger DDL

The following SQL can be used to query your database system tables for trigger DDL.

Sybase ASE

SELECT A.text
  FROM syscomments A
 WHERE A.id = Object_Id(:sTrigger)
 ORDER BY colid

Oracle

SELECT SUBSTR(text,1,Length(text) - 1), line
  FROM all_source
 WHERE type = 'TRIGGER'
   AND owner = :sOwner
   AND name = :sTrigger

SQL Server

SELECT A.text
  FROM syscomments A, sysobjects B
 WHERE A.id = B.id
   AND B.id = Object_Id(:sTrigger)
 ORDER BY colid

SQL Anywhere

IF (SELECT count(*)
      FROM sys.syscolumn c
      JOIN sys.sysdomain d ON c.domain_id=d.domain_id
      JOIN sys.systable t ON c.table_id=t.table_id
     WHERE t.table_id = (SELECT A.table_id
                           FROM sys.SYSTABLE A, dbo.sysusers B
                          WHERE Upper(A.table_name) =
                                Upper('SYSTRIGGER')
                            AND A.creator = B.suid)
                            AND Upper(c.column_name) =
                                Upper('object_id')) > 0
BEGIN
    SELECT IsNull(source, trigger_defn) as 'text'
      FROM SYSTRIGGER
     WHERE object_id = Object_Id(:sTrigger)
END
ELSE
BEGIN
    SELECT IsNull(source, trigger_defn) as 'text'
      FROM SYSTRIGGER
     WHERE Cast(trigger_id+300000 as integer) = Object_Id(:sTrigger)
END
SQL Query Tool Download
Download Free Trial!
18,269 KB - Version: 6.2.0

QweryBuilder is an SQL Editor and Query Tool. Its purpose is to make accessing information from a database simple, quick, accurate and efficient.

Work with your SQL Server, ASE, SQL Anywhere and Oracle databases in one single application.

"QweryBuilder is a great, easy to use tool, that is a part of my everyday programmer life."

Read More Testimonials
Copyright © 2008-2010 Werysoft Inc. All rights reserved.
SQL Query Tool | SQL Editor | Database Development Tool | SQL References | Testimonials