Retrieving all of the triggers for each table. : sysobjects « System Tables Views « SQL Server / T-SQL Tutorial






13>
14>
15>     SELECT name,
16>            COALESCE(OBJECT_NAME(instrig), 'N/A') AS InsertTrigger,
17>            COALESCE(OBJECT_NAME (updtrig), 'N/A') AS UpdateTrigger,
18>            COALESCE(OBJECT_NAME (deltrig), 'N/A') AS DeleteTrigger
19>     FROM sysobjects
20>     WHERE type = 'U'
21>     ORDER BY name
22> GO
name                                                                                                                             InsertTrigger
                                                          UpdateTrigger                                                                                                                    DeleteTrigger

-------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------
--------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------
-------------------------------------------------------------------------------------------------------------------
MSreplication_options                                                                                                            N/A
                                                          N/A                                                                                                                              N/A

department_pivot                                                                                                               N/A
                                                          N/A                                                                                                                              N/A

SalesMw                                                                                                                          N/A
                                                          N/A                                                                                                                              N/A

spt_fallback_db                                                                                                                  N/A
                                                          N/A                                                                                                                              N/A

spt_fallback_dev                                                                                                                 N/A
                                                          N/A                                                                                                                              N/A

spt_fallback_usg                                                                                                                 N/A
                                                          N/A                                                                                                                              N/A

spt_monitor                                                                                                                      N/A
                                                          N/A                                                                                                                              N/A

spt_values                                                                                                                       N/A
                                                          N/A                                                                                                                              N/A


(8 rows affected)








27.33.sysobjects
27.33.1.sysobjects contains a row for each database object.
27.33.2.Dropping all the triggers in the database using a cursor and dynamic execution.
27.33.3.Retrieving all of the triggers for each table.
27.33.4.Query sysobjects for user table, not system table
27.33.5.Check the existance of a table by querying sysobjects