Viewing Jobs in TSQL

  • I have some jobs that i have inherited on my SQL server. One of them has 14 steps!!! is there a way i can open the job in TSQL in order to prevent me from having to copy all the steps one by one?

  • Have you tried scripting them out, using Enterprise Manager?

  • yes however, it scripts them as if i wanted to create it with all the job attributes, thus completly over complicating it...

  • Try going to 'msdb' and running:

    SELECT j.name job_name

         , s.step_id

         , s.step_name

         , s.command

    FROM   sysjobs     j

      JOIN sysjobsteps s ON j.job_id = s.job_id

    ORDER BY j.name

     

  • kool... any idea how i can get the Command column to actually show all the info. i'm assuming the data type cuts it off...

  • It should pretty much all be there.  The 'sysjobsteps.command' column is defined as an NVARCHAR (3200), meaning it will hold 1600 characters.  I've never tried creating a job step that had more characters than that.  If you're looking at it through Query Analyzer, double-click the right end of the column header, and it ought to expand.  If your Query Analyzer row output still looks truncated, go to Tools -> Options -> Results and bump up your 'maximum columns per column value (I've set mine at 8000).

  • THANKS A MILLION!! that did it

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply