This is a script to list the code for ALL triggers in database
declare @trgName varchar(500)
DECLARE @trg_cursor CURSOR
set @trg_cursor=CURSOR FOR
SELECT name FROM sysobjects WHERE xtype='TR'
OPEN @trg_cursor
FETCH NEXT
FROM @trg_cursor INTO @trgName
WHILE @@FETCH_STATUS = 0
BEGIN
exec sp_helptext @trgName
FETCH NEXT
FROM @trg_cursor INTO @trgName
END
CLOSE @trg_cursor
DEALLOCATE @trg_cursor
GO
Enjoy :)
No comments:
Post a Comment