View all triggers

,

this script simply returns list of all triggers and their dependant tables in current database.
Ex:Select * from rk_vAlltriggers

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW rk_vAlltriggers
as
/*
Author	:Rajani
Date	:27-11-2003
Note	:This view lists out all available triggers in the 
current database
Use     : Select * from rk_vAlltriggers
*/
	select
	trigger_name = name,
	trigger_owner = user_name(uid),
	isupdate = ObjectProperty( id, 'ExecIsUpdateTrigger'),
	isdelete = ObjectProperty( id, 'ExecIsDeleteTrigger'),
	isinsert = ObjectProperty( id, 'ExecIsInsertTrigger'),
	isafter = ObjectProperty( id, 'ExecIsAfterTrigger'),
	isinsteadof = ObjectProperty( id, 'ExecIsInsteadOfTrigger'),
	object_name(parent_obj) as 'Parent Table'
	from sysobjects
	where type = 'TR'

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

Rate

Share

Share

Rate