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-2024

Updated:  04/17/2024 12:26
This page added:  11 September 2020