views:

29

answers:

2

hi,

Ex: for store procedure we use sp_helptext .is there any keyword for viewing jobs in text in sql server 2005

regards kumar

+1  A: 

You can query the various tables in msdb database to get the list of the jobs and their details.

For example

select * from msbdb.dbo.sysjobs

will give you the list of all the jobs in the server while

select * from msdb.dbo.sysjobactivity 

will give you the job activity details.

no_one
i want to view the script of the specific job ?
kumar
A: 

For stuff like this where I know how to do something in Management Studio but aren't sure of the way to do it by code I sometimes start a profiler trace then perform the action in Management Studio to see what that is doing. Doing that on my system indicates that the following might help.

exec msdb.dbo.sp_help_jobstep @job_name = 'Your job name'

If you look at the definition of that it seems to use msdb.dbo.sysjobsteps

Martin Smith