?
Solved

Query

Posted on 2011-09-13
9
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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 2000 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

764 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