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


© 2020-2022

Updated:  05/16/2022 16:21
This page added:  11 September 2020