Sharing the information you need to get development done!
Welcome to DevAuthority.Com Sign in | Join | Help
in Search

be-#

In SQL Server, search ALL objects for text

Persons familiar with TOAD for Oracle know about the fairly elaborate search function that lets you search for particular text in procedures, functions, views, column names, triggers, pretty much anything.

There's a way to do that in SQL Server as well, though you kind of have to "do it yourself." 

Use the query below.  Make sure that you are "in" the database that you mean to search before you run this query.

select * from sysobjects o, syscomments c where o.id=c.id

and c.text like '%your search text here%'

You can also limit your search by object type.  For example:

select * from sysobjects o, syscomments c where o.id=c.id

and c.text like '%mysearchstring%'

and xtype='P' --search stored procedures only

The complete list of types is below.  For more information, see:

http://articles.techrepublic.com.com/5100-9592_11-6142579.html

  • C: Check constraint
  • D: Default constraint
  • F: Foreign Key constraint
  • L: Log
  • P: Stored procedure
  • PK: Primary Key constraint
  • RF: Replication Filter stored procedure
  • S: System table
  • TR: Trigger
  • U: User table
  • UQ: Unique constraint
  • V: View
  • X: Extended stored procedure
  • Published Monday, December 17, 2007 1:19 PM by ebuatois

    Comments

    No Comments
    Anonymous comments are disabled







    This Blog

    Post Calendar

    <December 2007>
    SuMoTuWeThFrSa
    2526272829301
    2345678
    9101112131415
    16171819202122
    23242526272829
    303112345

    Syndication



    Powered by Community Server, by Telligent Systems