Home All Groups Group Topic Archive Search About

How can I print my SQL Server agent jobs?

Author
26 Feb 2007 2:29 PM
Wayne Erfling
GlacierCall me old school, but sometimes I'd like to just print out a SQL Server agent job for review.

Is there a built-in feature for this?

Does somebody know of an external script, shareware tool, etc. that can do this?

Thanks!

---Wayne

Author
26 Feb 2007 5:49 PM
Aaron Bertrand [SQL Server MVP]
SQL Server 2005:

Open Management Studio
Open Object Explorer
Expand (server/instance x) registration
Expand SQL Server Agent
Expand Jobs
Right-click (job x) and choose Script Job As > Create To >
Choose New Query Editor Window, FIle, or Clipboard

SQL Server 2000:

Open Enterprise Mangler
Expand (server/instance x) registration
Expand Management
Expand SQL Server Agent
Left-click on Jobs
In the right-hand pane, Right-click (job x) and choose All Tasks > Generate
SQL Script
Enter a file name (with path)
Click OK


"Wayne Erfling" <wayne_erfl***@mindspring.com> wrote in message
news:%23w$CEKbWHHA.600@TK2MSFTNGP05.phx.gbl...
GlacierCall me old school, but sometimes I'd like to just print out a SQL
Server agent job for review.

Is there a built-in feature for this?

Does somebody know of an external script, shareware tool, etc. that can do
this?

Thanks!

---Wayne
Author
27 Feb 2007 1:46 PM
Wayne Erfling
I did that, but the "substance" of the stored procedures (what the steps execute) is a relatively small percentage of the total script.

I was looking for something more formatted, and thought maybe there was something like that as part of somebody's tool or add-on.  "print" and "job" are so common that I just get a lot of useless pages when I do a [e.g. Google] search.

---Wayne
  "Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message news:eu4F13cWHHA.5060@TK2MSFTNGP06.phx.gbl...
  SQL Server 2005:

  Open Management Studio
  Open Object Explorer
  Expand (server/instance x) registration
  Expand SQL Server Agent
  Expand Jobs
  Right-click (job x) and choose Script Job As > Create To >
  Choose New Query Editor Window, FIle, or Clipboard

  SQL Server 2000:

  Open Enterprise Mangler
  Expand (server/instance x) registration
  Expand Management
  Expand SQL Server Agent
  Left-click on Jobs
  In the right-hand pane, Right-click (job x) and choose All Tasks > Generate
  SQL Script
  Enter a file name (with path)
  Click OK


  "Wayne Erfling" <wayne_erfl***@mindspring.com> wrote in message
  news:%23w$CEKbWHHA.600@TK2MSFTNGP05.phx.gbl...
  GlacierCall me old school, but sometimes I'd like to just print out a SQL
  Server agent job for review.

  Is there a built-in feature for this?

  Does somebody know of an external script, shareware tool, etc. that can do
  this?

  Thanks!

  ---Wayne
Author
27 Feb 2007 2:05 PM
Aaron Bertrand [SQL Server MVP]
So are you saying that you only care about the SQL code embedded within each
step?  Then you are not trying to print the job, you are trying to print the
SQL code and/or the stored procedures that are called.

Ideally, your jeb steps call stored procedures, then it's just a matter of
EXEC sp_helptext procedure_name and printing the result.

Otherwise, you have to go after the raw SQL code in the sys tables in msdb.

What version of SQL Server are you using?





"Wayne Erfling" <wayne_erfl***@mindspring.com> wrote in message
news:%23cySwWnWHHA.1636@TK2MSFTNGP02.phx.gbl...
I did that, but the "substance" of the stored procedures (what the steps
execute) is a relatively small percentage of the total script.

I was looking for something more formatted, and thought maybe there was
something like that as part of somebody's tool or add-on.  "print" and "job"
are so common that I just get a lot of useless pages when I do a [e.g.
Google] search.

---Wayne
Author
27 Feb 2007 6:09 PM
Wayne Erfling
Thanks for sticking around.

I'm just looking for something to bring a multiple step job together as a whole (and that I will be able to print for reference).  For example:

Step 1 "name of step"  (database=<database>)

EXEC INITIALIZE_BIG_JOB

Step 2 "name of step" (database=<database>)

EXEC INSERT_SOME_DATA

Step 2 "name of step" (database=<database>)

EXEC UPDATE_SOME_DATA


and so on.

I'm using SSMS as my front end, mostly with SQL Server 2000 data bases.

I guess I could put something together from the sys tables.  I found a real useful tool to sort project files in SSMS, and just thought somebody must have written some tools to help with SQL jobs.

Thanks again.

---Wayne
  "Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message news:OChxbfnWHHA.4216@TK2MSFTNGP02.phx.gbl...
  So are you saying that you only care about the SQL code embedded within each
  step?  Then you are not trying to print the job, you are trying to print the
  SQL code and/or the stored procedures that are called.

  Ideally, your jeb steps call stored procedures, then it's just a matter of
  EXEC sp_helptext procedure_name and printing the result.

  Otherwise, you have to go after the raw SQL code in the sys tables in msdb.

  What version of SQL Server are you using?





  "Wayne Erfling" <wayne_erfl***@mindspring.com> wrote in message
  news:%23cySwWnWHHA.1636@TK2MSFTNGP02.phx.gbl...
  I did that, but the "substance" of the stored procedures (what the steps
  execute) is a relatively small percentage of the total script.

  I was looking for something more formatted, and thought maybe there was
  something like that as part of somebody's tool or add-on.  "print" and "job"
  are so common that I just get a lot of useless pages when I do a [e.g.
  Google] search.

  ---Wayne

AddThis Social Bookmark Button