Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Stored Procedures - how to view code 1

Status
Not open for further replies.

k108

Programmer
Joined
Jul 20, 2005
Messages
230
Location
US
Hi,

Is there a way to view the underlying query with SQL Server built-in stored procedures?

For example, I'd like to see the underlying code for "sp_help_job".

Specifically, I'd like to know which table its querying to get the "execution status" of a job. Although the sysjobhistory table has a field that contains the CURRENT execution status of jobs, this table is so big, it takes forever to return... sp_help_job must not be using this table, because it doesn't take nearly as long when I run sp_help_job vs. my own query of the sysjobhistory table.

Anyhow, if I could find the code, the mystery would be solved.

Thanks!!

 
Sorry this might be better..

use Msdb
exec sp_helptext [sp_help_job]
 
K (dont' take offence to this)

I realize you havn't been using this site for long (and that is proabaly why you havn't been awarding anyone as providing you with helpfull information) but I aleast like to see little star's appear beside posts I have made that have been helpfull.

We don't get paid for helping, so the "Ego" recogintion of a worthwile act is what provides much of the motivation to seeing if we can help solve someones issues goes along way.

If you want to motivate folks to help you, then help to give their efforts the recognition they deserve.

Just a sugestion.

Rob
 
OMG, the stored procedure is horribly complex, not worth the effort...

but sp_helptext was the answer!

Thanks
 
Oh, I had no idea I was supposed to be rating people. I am more than happy to do so! I am a little slow, please tell me how to award a "star
 
ok, duh just found it
 
Ok... Now for the serious question.

Did you just want to beable to return if the job is running or was it history you were looking for?

Rob
 
Actually, please see my post "help, nightmare" :-) That explains my sorry situation. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top