Most Popular
Recently Added
Recently Updated

Drop Triggers for Sybase

The following scripts can be used to drop triggers on Sybase ASE and Sybase SqlAnywhere.

For Sybase ASE :

DECLARE C_trigger CURSOR FOR
SELECT 'DROP TRIGGER '||name  from  sysobjects where name like 'SYM_ON%' and type='TR'
GO
BEGIN
  DECLARE @tname VARCHAR(120)
  OPEN C_trigger
  FETCH C_trigger INTO @tname

  WHILE @@sqlstatus  2
  BEGIN
    select 'executing ...: '||@tname
    exec(@tname)
    FETCH C_trigger INTO @tname
  END
END

GO

For SqlAnywhere :

DECLARE C_trigger CURSOR FOR
SELECT 'DROP TRIGGER '||trigger_name  from  SYS.SYSTRIGGER where trigger_name like 'SYM_ON%'
DECLARE @tname VARCHAR(120)
OPEN C_trigger
FETCH C_trigger INTO @tname
WHILE @@sqlstatus  2
BEGIN
 select 'executing ...: '||@tname
 execute (@tname)
 FETCH C_trigger INTO @tname
END

GO

Properties ID: 000033   Views: 2635   Updated: 10 years ago
Filed under: