Solved

Query

Posted on 2011-09-13
9
188 Views
Last Modified: 2012-05-12
Hi,
I have a lot SProc. in the database , and I need query search in SProc.

Thanks
0
Comment
Question by:samprg
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 36533348
You can search the schema routines

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%your search text%'
AND ROUTINE_TYPE='PROCEDURE'
0
 

Author Comment

by:samprg
ID: 36533369
It is good, but did not bring  all SProc.
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 36533387
You can try the syscomments view but I doubt you will get different results

    SELECT OBJECT_NAME(id)
    FROM syscomments
    WHERE [text] LIKE '%your search text%'
    AND OBJECTPROPERTY(id, 'IsProcedure') = 1
    GROUP BY OBJECT_NAME(id)
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 36533538
>>It is good, but did not bring  all SProc. <<
Care to elaborate?  If we do not know the specific problem we cannot give you a good solution.
0
 
LVL 12

Accepted Solution

by:
jagssidurala earned 500 total points
ID: 36533838
try below query, i hope this will helps you

Select       name,
      *
from       sys.objects
Where       Object_Id
In
(
    Select id from syscomments where Text like '%your text here%'
)
0
 

Author Comment

by:samprg
ID: 36533855
ewangoya:
First one is beter,but I tested it gives me 2 SPro. but I have 3 SProc

acperkins:
It is very simple. I need query search in all SProc. in the database

Thanks all of you
0
 
LVL 9

Expert Comment

by:sachinpatil10d
ID: 36535203
declare @name nvarchar(100)
set @name = 'C%'
select * from sys.objects where type_desc = 'SQL_STORED_PROCEDURE'
and name like @name
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 36536476
>>It is very simple. I need query search in all SProc. in the database<<
Unfortunately that tells us nothing.

Good luck.
0
 

Author Closing Comment

by:samprg
ID: 36537619
Awesom
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question