Most Popular
Recently Added
Recently Updated

Drop Triggers for SQL Server

The following SQL can be run to dynamically drop triggers from SQL Server:

declare @drop_sql nvarchar(1000);
declare trigger_cursor cursor local for 
select 'drop trigger ' + name from sysobjects where type='TR' and name like 'SYM_%';
open trigger_cursor  
fetch next from trigger_cursor into @drop_sql
while @@FETCH_STATUS = 0 begin
  print @drop_sql;
  EXECUTE sp_executesql  @drop_sql;
  fetch next from trigger_cursor into @drop_sql
end
close trigger_cursor
deallocate trigger_cursor

Properties ID: 000019   Views: 2042   Updated: 11 years ago
Filed under: