Skip to content

Instantly share code, notes, and snippets.

@dgershman
Created January 7, 2014 23:21
Show Gist options
  • Select an option

  • Save dgershman/8308759 to your computer and use it in GitHub Desktop.

Select an option

Save dgershman/8308759 to your computer and use it in GitHub Desktop.
SET NOCOUNT ON
DECLARE @tmp TABLE
(
Id int identity(1,1),
Name nvarchar(255)
)
INSERT INTO @tmp
SELECT Name
FROM sys.objects
WHERE type = 'SN'
DECLARE @x int
DECLARE @xMax int
DECLARE @syn varchar(255)
SET @x = 1
SELECT @xMax = MAX(Id) FROM @tmp
WHILE @x < @xMax
BEGIN
SELECT @syn = Name From @tmp WHERE Id = @x
PRINT @syn
PRINT '==='
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%' + @syn + '%'
SET @x = @x + 1
END
SET NOCOUNT OFF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment