Technical Article

Trigger Finder

,

Finds all the triggers in a particular database.

****** Object:  Stored Procedure dbo.ProcTrgFinder    Script Date: 09/16/2002 9:05:04 AM ******/if exists (select * from sysobjects where id = object_id(N'[dbo].[ProcTrgFinder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ProcTrgFinder]
GO

SET QUOTED_IDENTIFIER  OFF    SET ANSI_NULLS  ON 
GO

/****** Object:  Stored Procedure dbo.ProcTrgFinder    Script Date: 09/16/2002 9:05:05 AM ******/--By Abhijit
CREATE Procedure ProcTrgFinder As
DECLARE @tname nvarchar(50)
Declare @sqlstat nvarchar(900)
Declare CurTables CURSOR KEYSET FOR
Select Table_Name From INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
Set @tname = N'ATTRIBUTES'
OPEN CurTables
 FETCH NEXT FROM CurTables INTO @tname
 Set @sqlStat = N'sp_helptrigger ' + @tname
 Print @sqlStat
 Exec sp_executeSql @sqlStat
WHILE @@FETCH_STATUS = 0
 BEGIN
 FETCH NEXT FROM CurTables INTO @tname
 Set @sqlStat = N'sp_helptrigger ' + @tname
 Print @sqlStat
 Exec sp_executeSql @sqlStat
 END
Close CurTables
Deallocate CurTables

GO

SET QUOTED_IDENTIFIER  OFF    SET ANSI_NULLS  ON 
GO

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating