Search This Blog

Monday, August 9, 2010

SQL Server: Search a Text in Stored Procedure

Sometimes we need to find some objects used in stored procedure or similar other requirement we need to search some text used in Stored procedure. The following lines of code is very useful in for it.

SELECT DISTINCT OBJECT_NAME(id) FROM syscomments WHERE [text] LIKE '%YOURTEXT%'

Replace YOURTEXT with your actual text to be searched.

2 comments:

  1. I think that, you are expert in SQL but I am newbie to this field. I want more basic information about SQL. Keep on posting.

    ReplyDelete
  2. Your post seems to be really brilliant. I am eagerly waiting for your next update..

    ReplyDelete

Searching duplicate Record

Very often we have to look for duplicate records in the database, Below is the query which can give you the result. SELECT COL1, COL2 , ...