--Select * from sysobjects where type = 'U' and category = 0
select
so
.name,
sc
.text
from
sysobjects so
inner join syscomments sc on so.id = sc.id
where
sc
.text like '%ROLES%'
and sc.text like '%select%'
-- or sc.text like '%WorkGroup%'
CREATE FUNCTION LastIndexOf (@strValue VARCHAR(4000), @strChar VARCHAR(50)) RETURNS INT AS BEGIN DECLARE @index INT SET @index = 0 WHILE CHARINDEX(@strChar, @strValue) > 0 BEGIN SET @index = @index + CASE WHEN CHARINDEX(@strChar, @strValue) > 1 THEN (LEN(@strValue) - LEN(SUBSTRING(@strValue,CHARINDEX(@strChar, @strValue) + LEN(@strChar),LEN(@strValue)))) ELSE 1 END SET @strValue = SUBSTRING(@strValue,CHARINDEX(@strChar, @strValue) + len(@strChar),LEN(@strValue)) END RETURN @index END