82

SQL Server: drop all triggers in a database

SQL Server: drop all triggers in a database
  
use your_database; 

declare @s varchar(max),
		@sql varchar(max)

declare gd cursor local for 
select name
from sysobjects
where xtype = 'TR'

open gd

fetch next from gd into @s

while @@fetch_status = 0
begin 
	set @sql = 'drop trigger ' + @s

	print @sql

	exec (@sql)

	fetch next from gd into @s
end 

close gd
deallocate gd 


Comments (0)


This thread has been closed from taking new comments.