SQL Queries

css navigation by Css3Menu.com

Find String in Stored Proc

Saved my bacon dozens of times when I knew I'd already invented the wheel.
USE YourDB
--this one finds all stored procedures that contain the given text
SELECT OBJECT_NAME(id) 
    FROM SYSCOMMENTS 
    WHERE [text] LIKE '%UOM%' 
    AND OBJECTPROPERTY(id, 'IsProcedure') = 1 
    GROUP BY OBJECT_NAME(id)
order by object_name(id)

---Note that this works for 'IsTrigger' and 'IsView' as well


© MMXX

Updated:  12/02/2020 18:43
This page added:  11 September 2020