Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

What are the triggers in SQL Server

13 December,2012 by Tom Collins

I use these two methods to  return a list of TRIGGERS for a SQL Server database.   Sometimes I need to just return a list of TRIGGERS for a specific table -   where I add an extra predicate  to return a TRIGGER list just for a table 

Method 1 – uses the view sys.triggers. The sys.triggers view returns DML and DDL triggers. The view  returns SQL Triggers and Assembly Triggers

Method 2 – shows only DML triggers , as they are schema scoped, and sysobjects returns only schema scoped objects.

 

--Method 1 

select object_name(parent_id) as [Table_name],object_name(object_id) as [Trigger_Name] from sys.triggers


--Method 2 
SELECT DISTINCT	SO.[name] AS [Table_name], TR.[name] AS [Trigger_name]
FROM	[sysobjects] as SO
JOIN	[sysobjects] as TR
	ON	SO.[id] = TR.[parent_obj]
WHERE	TR.[type] = 'TR'
--AND SO.[name] = ‘my_table’
ORDER BY [Table_name], [Trigger_name]

 Read More

SQL Server – Delete SQL Logon TRIGGER syntax - SQL Server DBA

SQL Server – Restrict SQL Server Logons by IP with EVENTDATA ...

SQL Server recompile error after upgrade from 2000 to 2005

List Foreign Keys referencing tables in SQL Server

How to find all identity columns in SQL Server

How to find default values of all SQL Server columns

How to find computed columns on a SQL Server table

Find SQL Server LOB Columns


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on What are the triggers in SQL Server


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer