Need to find list of tables used in stored procedure with “nolock”? [duplicate]

try this one :-

Declare  @stObjToFind       Varchar(150)

Select   @stObjToFind = 'With (Nolock)'

Select   so.id
        ,so.name
        ,so.xtype
From    sysobjects As so With (Nolock)
        Join
        (
            Select  Distinct sc.id
            From    syscomments As sc With (Nolock)
            Where   sc.text Like '%' + @stObjToFind + '%'
        ) As sc0 On so.id = sc0.id
Where   so.name <> @stObjToFind

Browse More Popular Posts

Leave a Comment