Skip to content

Instantly share code, notes, and snippets.

@tonidy
Created November 24, 2011 14:47
Show Gist options
  • Select an option

  • Save tonidy/1391498 to your computer and use it in GitHub Desktop.

Select an option

Save tonidy/1391498 to your computer and use it in GitHub Desktop.
T-SQL to find a text in stored procedure
--kode#1
SELECT OBJECT_NAME(id)
FROM SYSCOMMENTS
WHERE [text] LIKE '%Foo%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
--kode#2
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Foo%'
AND ROUTINE_TYPE='PROCEDURE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment