April 14, 2008 at 4:18 am
Hi All,
I need solution for the following :
I have several stored procedures in a database.
For example, consider I am having 50 procedures in a database.
I need to know in which procedure a particular statement exists.
It may be one sproc or in many sprocs.
For example : If any of my sproc contains the following query in it
Select distinct orderid from order;
I need to know which all sproc contains the above statement.It should show all the sprocs in which particular query statement appears.
How to get this
Thanks in advance,
Nisha
April 14, 2008 at 4:34 am
Nisha
The information you're looking for is in the sys.sql_modules system view.
John
April 14, 2008 at 4:43 am
John,
Can you give me the query for executing this...
Thanks
Nisha
April 14, 2008 at 4:47 am
Nisha
I can, but I won't. Look up sys.sql_modules in Books Online, then try to write the query yourself. If you're stuck on anything particular then post back and we'll try to help you out. But doing all the work for you... that would just be too easy and you wouldn't learn anything.
Good luck
John
April 14, 2008 at 4:58 am
April 14, 2008 at 5:07 am
Thanks a lot....
I got the solution.
April 14, 2008 at 5:10 am
or use the "multi brand" version:
INFORMATION_SCHEMA.ROUTINES
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 14, 2008 at 5:47 am
ALZDBA (4/14/2008)
or use the "multi brand" version:INFORMATION_SCHEMA.ROUTINES
But be careful: this will only give you the first 4000 characters of the procedure definition.
John
April 14, 2008 at 6:03 am
Thank you for pointing to this "flaw".
That may be one of the reasons _not_ to use information_schema stuff.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply