Created
October 26, 2015 22:51
-
-
Save andyj/dde48ba98c1a8b55bb86 to your computer and use it in GitHub Desktop.
Searching MSSQL database for a Stored Proc by name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sp_MSforeachdb 'SELECT "?" AS DB, | |
| r.SPECIFIC_SCHEMA, r.routine_name, r.ROUTINE_DEFINITION, p.ORDINAL_POSITION, p.PARAMETER_MODE, p.PARAMETER_NAME, p.DATA_TYPE | |
| FROM [?].INFORMATION_SCHEMA.ROUTINES r | |
| JOIN [?].INFORMATION_SCHEMA.PARAMETERS p ON r.SPECIFIC_SCHEMA = p.SPECIFIC_SCHEMA AND r.SPECIFIC_NAME = p.SPECIFIC_NAME | |
| WHERE | |
| r.ROUTINE_TYPE = ''PROCEDURE'' | |
| AND left(r.ROUTINE_NAME,2) <> ''dt'' | |
| AND r.routine_name LIKE ''%yourStoredProcName%'' | |
| ORDER BY r.SPECIFIC_NAME ASC, p.ORDINAL_POSITION ASC' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment