Skip to content

Instantly share code, notes, and snippets.

@csprofile
Last active June 17, 2016 12:48
Show Gist options
  • Save csprofile/8a518ee815bfff15e0eea4e767fe83af to your computer and use it in GitHub Desktop.
Save csprofile/8a518ee815bfff15e0eea4e767fe83af to your computer and use it in GitHub Desktop.
Return table with all called stored procedures from a SP.
DECLARE @SPName NVARCHAR(MAX) = 'SPName'
DECLARE @T TABLE (T VARCHAR(MAX))
INSERT INTO @T
EXEC SP_HELPTEXT @SPName
SELECT LTRIM(REPLACE(T,' ',''))
FROM @T
WHERE T LIKE '%EXEC%'
AND T NOT LIKE '%xp_logevent%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment