Wednesday, 8 January 2014

Script to find the TRIGGER by using field name




This script will list out the Trigger details based on the input column name.

SELECT
                        SO.Name [Trigger Name],
                        SSC.TEXT TriggerText
FROM                                
                        sys.syscomments SSC,
                        sys.objects SO
WHERE
                        SSC.Id                                                = SO.OBJECT_ID
                        AND SSC.TEXT       LIKE '%' + 'Name the Specific Column Name Here' + '%'

                        AND TYPE                           = 'TR'