Quickly search for SQL database data and objects in SSMS

/*

  1) How to quickly search for SQL database data and objects in SSMS

  2) Searching for sys schemaviews

*/


DECLARE @searchString nvarchar( 50 );

SET @searchString = '@userId';


SELECT DISTINCT

    s.name AS Schema_Name, 

O.name AS Object_Name , 

C.text AS Object_Definition

FROM syscomments C 

   INNER JOIN sys.objects O

     ON C.id = O.object_id

   INNER JOIN sys.schemas S

     ON O.schema_id = S.schema_id

WHERE C.text LIKE  '%' + @searchString + '%'

     OR O.name LIKE '%' + @searchString + '%'

ORDER BY Schema_name, Object_name;

ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^