Wednesday, 13 June 2012

Useful query in SQL


How to Find That The Table,SP,View,Function is Used In Our DataBase by Its Name ???

Here is Query For That :

SELECT DISTINCT  sc.text
FROM    syscomments sc
INNER JOIN      sysobjects sobj ON sc.id=sobj.id
WHERE sc.text  LIKE   %[Table_Name] or [SP_Name] or  [Function_Name] or [View_Name] %

Enter Your Table Name or Sp or Function or View Name that You want to Search in Database,
This will give you result where the supplied Name is used in Database

No comments:

Post a comment