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
Solved

Query

Posted on 2011-09-13
9
186 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:ewangoya
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:ewangoya
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.

791 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