Reputation: 3327
I have many stored procedures in my database. I have to transfer a few of them to a different server.
I need to find the procedures starting with "ABC".
How do I search all these stored procedures?
Upvotes: 0
Views: 4543
Reputation:
a little tweak of Adam Wenger answer, that worked for me:
SELECT o.name
FROM sysobjects AS o
INNER JOIN INFORMATION_SCHEMA.ROUTINES AS p ON o.name = p.SPECIFIC_NAME
WHERE o.name LIKE '%price%'
OR
SELECT o.name
FROM sysobjects AS o
INNER JOIN sys.procedures AS p ON o.id = p.object_id
WHERE o.name LIKE '%price%'
Upvotes: 2
Reputation: 2865
No join necessary here and uses the INFORMATION_SCHEMA view (available since SQL Server 2005)
SELECT SPECIFIC_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_NAME LIKE 'ABC%'
ORDER BY SPECIFIC_NAME ASC
Upvotes: 0
Reputation: 17570
According to the documentation, this query should give you the procedures that start with "ABC":
SELECT o.name
FROM sysobjects AS o
INNER JOIN sysprocedures AS p ON o.id = p.id
WHERE o.name LIKE "ABC%"
Upvotes: 3