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
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_erfling@.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
|||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_erfling@.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
|||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_erfling@.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
|||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_erfling@.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
Showing posts with label jobs. Show all posts
Showing posts with label jobs. Show all posts
Monday, March 26, 2012
how can I prevent all jobs start up at the same time?
If I create a job which execute automatically every hour start from 00:00
end to 23:00, does it mean it will start up at the exact 00:00,
01:00.....23:00?
if the answer is true, then if I create many (very very many) jobs which
start automatically in the same rule, will the sql server agent start every
job in the same time? All start up at the exact o'clock?
If the answer is true too, how can I prevent all jobs start up at the same
time?> If I create a job which execute automatically every hour start from 00:00
> end to 23:00, does it mean it will start up at the exact 00:00,
> 01:00.....23:00?
Yes.
> if the answer is true, then if I create many (very very many) jobs which
> start automatically in the same rule, will the sql server agent start ever
y
> job in the same time? All start up at the exact o'clock?
Almost (there may be small differences, usually less than one second).
> If the answer is true too, how can I prevent all jobs start up at the same
> time?
Make only one job with many steps (one step for each job that you would
have created).
Razvan|||if I create every job execute automatically every hour (and everyday) BUT
begin from a random minute (not always from 00:00), can it prevent all jobs
start up at the same time?
> Almost (there may be small differences, usually less than one second).
>|||what is the problem if no. of jobs start at the same time.
If you have any problem you can schedule it some of them at start at
00:00 and repeat after every 1 hour
some start at 00:10 and repeat after every 1 hour so it will run
01:10,02:10 and so on...
Jobs will not run at randomly time from your start time.
Or create one job with multiple steps.
Regards
Amish
*** Sent via Developersdex http://www.examnotes.net ***|||Thanks, I got it.
"Amish Shah" <shahamishm@.gmail.com>
'?:egDI6mRFGHA.532@.TK2MSFTNGP15.phx.gbl...
> what is the problem if no. of jobs start at the same time.
> If you have any problem you can schedule it some of them at start at
> 00:00 and repeat after every 1 hour
> some start at 00:10 and repeat after every 1 hour so it will run
> 01:10,02:10 and so on...
> Jobs will not run at randomly time from your start time.
> Or create one job with multiple steps.
>
>
> Regards
> Amish
> *** Sent via Developersdex http://www.examnotes.net ***|||You could consider a mechanism using sp_start_job from one job to start
another.
I'm wondering why you have so many jobs...But anyhow you could even
use a table to hold the names of jobs and parameterise what starts so
you read the top un-run out a table and mark it as run...|||There is a limited number of threads that Agent will spawn for each job subs
ystem. The value is
specified in the registry (s
and you will find). It is probably not suppo
rted to change the
value, unless you find some article (Books Online or KB) that discusses this
.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Frank Lee" <Reply@.to.newsgroup> wrote in message news:ONwlAmQFGHA.2040@.TK2MSFTNGP14.phx.gb
l...
> If I create a job which execute automatically every hour start from 00:00
end to 23:00, does it
> mean it will start up at the exact 00:00, 01:00.....23:00?
> if the answer is true, then if I create many (very very many) jobs which s
tart automatically in
> the same rule, will the sql server agent start every job in the same time?
All start up at the
> exact o'clock?
> If the answer is true too, how can I prevent all jobs start up at the same
time?
>|||I see. Thank you for telling me about that.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
'?:urZFVrTFGHA.2696@.TK2MSFTNGP14.phx.gbl...
> There is a limited number of threads that Agent will spawn for each job
> subsystem. The value is specified in the registry (s
and you will
> find). It is probably not supported to change the value, unless you find
> some article (Books Online or KB) that discusses this.
> --
end to 23:00, does it mean it will start up at the exact 00:00,
01:00.....23:00?
if the answer is true, then if I create many (very very many) jobs which
start automatically in the same rule, will the sql server agent start every
job in the same time? All start up at the exact o'clock?
If the answer is true too, how can I prevent all jobs start up at the same
time?> If I create a job which execute automatically every hour start from 00:00
> end to 23:00, does it mean it will start up at the exact 00:00,
> 01:00.....23:00?
Yes.
> if the answer is true, then if I create many (very very many) jobs which
> start automatically in the same rule, will the sql server agent start ever
y
> job in the same time? All start up at the exact o'clock?
Almost (there may be small differences, usually less than one second).
> If the answer is true too, how can I prevent all jobs start up at the same
> time?
Make only one job with many steps (one step for each job that you would
have created).
Razvan|||if I create every job execute automatically every hour (and everyday) BUT
begin from a random minute (not always from 00:00), can it prevent all jobs
start up at the same time?
> Almost (there may be small differences, usually less than one second).
>|||what is the problem if no. of jobs start at the same time.
If you have any problem you can schedule it some of them at start at
00:00 and repeat after every 1 hour
some start at 00:10 and repeat after every 1 hour so it will run
01:10,02:10 and so on...
Jobs will not run at randomly time from your start time.
Or create one job with multiple steps.
Regards
Amish
*** Sent via Developersdex http://www.examnotes.net ***|||Thanks, I got it.
"Amish Shah" <shahamishm@.gmail.com>
'?:egDI6mRFGHA.532@.TK2MSFTNGP15.phx.gbl...
> what is the problem if no. of jobs start at the same time.
> If you have any problem you can schedule it some of them at start at
> 00:00 and repeat after every 1 hour
> some start at 00:10 and repeat after every 1 hour so it will run
> 01:10,02:10 and so on...
> Jobs will not run at randomly time from your start time.
> Or create one job with multiple steps.
>
>
> Regards
> Amish
> *** Sent via Developersdex http://www.examnotes.net ***|||You could consider a mechanism using sp_start_job from one job to start
another.
I'm wondering why you have so many jobs...But anyhow you could even
use a table to hold the names of jobs and parameterise what starts so
you read the top un-run out a table and mark it as run...|||There is a limited number of threads that Agent will spawn for each job subs
ystem. The value is
specified in the registry (s
rted to change the
value, unless you find some article (Books Online or KB) that discusses this
.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Frank Lee" <Reply@.to.newsgroup> wrote in message news:ONwlAmQFGHA.2040@.TK2MSFTNGP14.phx.gb
l...
> If I create a job which execute automatically every hour start from 00:00
end to 23:00, does it
> mean it will start up at the exact 00:00, 01:00.....23:00?
> if the answer is true, then if I create many (very very many) jobs which s
tart automatically in
> the same rule, will the sql server agent start every job in the same time?
All start up at the
> exact o'clock?
> If the answer is true too, how can I prevent all jobs start up at the same
time?
>|||I see. Thank you for telling me about that.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com>
'?:urZFVrTFGHA.2696@.TK2MSFTNGP14.phx.gbl...
> There is a limited number of threads that Agent will spawn for each job
> subsystem. The value is specified in the registry (s
> find). It is probably not supported to change the value, unless you find
> some article (Books Online or KB) that discusses this.
> --
Monday, March 19, 2012
how can I list running jobs
Hi,
I am experiencing db high cpu, no apps can run, how can I list running jobs?
ThanksJen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
I am experiencing db high cpu, no apps can run, how can I list running jobs?
ThanksJen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
how can I list running jobs
Hi,
I am experiencing db high cpu, no apps can run, how can I list running jobs?
Thanks
Jen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com
|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
I am experiencing db high cpu, no apps can run, how can I list running jobs?
Thanks
Jen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com
|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
how can I list running jobs
Hi,
I am experiencing db high cpu, no apps can run, how can I list running jobs
?
ThanksJen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?[/vbco
l]
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
I am experiencing db high cpu, no apps can run, how can I list running jobs
?
ThanksJen wrote:
> Hi,
> I am experiencing db high cpu, no apps can run, how can I list
> running jobs?
> Thanks
Exec msdb..sp_help_job @.execution_status = 1 -- just edxecuting
or
Exec msdb..sp_help_job @.execution_status = 0 -- not idle or suspended
David Gugick
Imceda Software
www.imceda.com|||On Fri, 21 Jan 2005 10:07:04 -0800, Jen
<Jen@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Hi,
>I am experiencing db high cpu, no apps can run, how can I list running jobs?[/vbco
l]
exec sp_who2
Shows CPU, blocks.
Or use the Enteprise Manager, Management / Current Activity /
Processes.
BTW, those are not referred to as "jobs", but as "threads", or
"processes", or "spids".
J.
Friday, February 24, 2012
How can I get the current job's name or job ID from a job step within the job
How can I get the current job's name or job ID from a job step within
the job in sql server?
In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
"tram" <tram_e@.hotmail.com> wrote in message
news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
> How can I get the current job's name or job ID from a job step within
> the job in sql server?
>
|||Chris,
I know the the tablenames, but we need to give either job ID or name to
get the output file name. After finishing step1, I should be able to
get the output fielname of step1 for current job without hard coding
....
ChrisR wrote:[vbcol=seagreen]
> In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Chris,
I know the the tablenames, but we need to give either job ID or name to
get the output file name. After finishing step1, I should be able to
get the output fielname of step1 for current job without hard coding
....
ChrisR wrote:[vbcol=seagreen]
> In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Perhaps this is of help?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104252327.066933.268140@.f14g2000cwb.googlegr oups.com...
> Chris,
> I know the the tablenames, but we need to give either job ID or name to
> get the output file name. After finishing step1, I should be able to
> get the output fielname of step1 for current job without hard coding
> ...
>
> ChrisR wrote:
> within
>
|||Use the [JOBID] job step token. See sp_add_job_step in BOL for details. Also
look at http://sqldev.net/sqlagent/SQLAgentStepTokens.htm
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"tram" <tram_e@.hotmail.com> wrote in message
news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
> How can I get the current job's name or job ID from a job step within
> the job in sql server?
>
|||Jasper,
I've tried using token. But didn't work. Would you give an example?
Thanks
Jasper Smith wrote:
> Use the [JOBID] job step token. See sp_add_job_step in BOL for
details. Also[vbcol=seagreen]
> look at http://sqldev.net/sqlagent/SQLAgentStepTokens.htm
> --
> HTH
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Did you check the samples at the web page that Jasper and me posted?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104265806.678523.298020@.z14g2000cwz.googlegr oups.com...
> Jasper,
> I've tried using token. But didn't work. Would you give an example?
> Thanks
>
> Jasper Smith wrote:
> details. Also
> within
>
|||Tibor,
I appreciate your reply. I've seen the examples , but is not working. I
was trying to know the JOB id of current job in the job step so that I
can get the output file name from sysjobsteps.
Anyway, thanks for your reply.
Tibor Karaszi wrote:[vbcol=seagreen]
> Did you check the samples at the web page that Jasper and me posted?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104265806.678523.298020@.z14g2000cwz.googlegr oups.com...
|||tram,
"Doesn't work" is not a very good problem description. I created a job with one jobstep and added
below SQL to the jobstep. Work just fine on my machine:
SELECT 'The output file name is "' + output_file_name + '"'
FROM msdb..sysjobsteps
WHERE job_id = [JOBID]
AND step_id = [STEPID]
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104323486.443287.4420@.z14g2000cwz.googlegrou ps.com...
> Tibor,
> I appreciate your reply. I've seen the examples , but is not working. I
> was trying to know the JOB id of current job in the job step so that I
> can get the output file name from sysjobsteps.
> Anyway, thanks for your reply.
>
> Tibor Karaszi wrote:
>
the job in sql server?
In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
"tram" <tram_e@.hotmail.com> wrote in message
news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
> How can I get the current job's name or job ID from a job step within
> the job in sql server?
>
|||Chris,
I know the the tablenames, but we need to give either job ID or name to
get the output file name. After finishing step1, I should be able to
get the output fielname of step1 for current job without hard coding
....
ChrisR wrote:[vbcol=seagreen]
> In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Chris,
I know the the tablenames, but we need to give either job ID or name to
get the output file name. After finishing step1, I should be able to
get the output fielname of step1 for current job without hard coding
....
ChrisR wrote:[vbcol=seagreen]
> In MSDB, start checking out the sysjobs, sysjobssteps, etc. tables.
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Perhaps this is of help?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104252327.066933.268140@.f14g2000cwb.googlegr oups.com...
> Chris,
> I know the the tablenames, but we need to give either job ID or name to
> get the output file name. After finishing step1, I should be able to
> get the output fielname of step1 for current job without hard coding
> ...
>
> ChrisR wrote:
> within
>
|||Use the [JOBID] job step token. See sp_add_job_step in BOL for details. Also
look at http://sqldev.net/sqlagent/SQLAgentStepTokens.htm
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"tram" <tram_e@.hotmail.com> wrote in message
news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
> How can I get the current job's name or job ID from a job step within
> the job in sql server?
>
|||Jasper,
I've tried using token. But didn't work. Would you give an example?
Thanks
Jasper Smith wrote:
> Use the [JOBID] job step token. See sp_add_job_step in BOL for
details. Also[vbcol=seagreen]
> look at http://sqldev.net/sqlagent/SQLAgentStepTokens.htm
> --
> HTH
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104250803.810521.121410@.z14g2000cwz.googlegr oups.com...
within[vbcol=seagreen]
|||Did you check the samples at the web page that Jasper and me posted?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104265806.678523.298020@.z14g2000cwz.googlegr oups.com...
> Jasper,
> I've tried using token. But didn't work. Would you give an example?
> Thanks
>
> Jasper Smith wrote:
> details. Also
> within
>
|||Tibor,
I appreciate your reply. I've seen the examples , but is not working. I
was trying to know the JOB id of current job in the job step so that I
can get the output file name from sysjobsteps.
Anyway, thanks for your reply.
Tibor Karaszi wrote:[vbcol=seagreen]
> Did you check the samples at the web page that Jasper and me posted?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "tram" <tram_e@.hotmail.com> wrote in message
> news:1104265806.678523.298020@.z14g2000cwz.googlegr oups.com...
|||tram,
"Doesn't work" is not a very good problem description. I created a job with one jobstep and added
below SQL to the jobstep. Work just fine on my machine:
SELECT 'The output file name is "' + output_file_name + '"'
FROM msdb..sysjobsteps
WHERE job_id = [JOBID]
AND step_id = [STEPID]
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"tram" <tram_e@.hotmail.com> wrote in message
news:1104323486.443287.4420@.z14g2000cwz.googlegrou ps.com...
> Tibor,
> I appreciate your reply. I've seen the examples , but is not working. I
> was trying to know the JOB id of current job in the job step so that I
> can get the output file name from sysjobsteps.
> Anyway, thanks for your reply.
>
> Tibor Karaszi wrote:
>
Subscribe to:
Posts (Atom)