Saturday, February 25, 2012

Agent Jobs

hello,
i am trying to create a job to execute an exe. i would like to kick off the
job through a trigger. however i am running into some prblems.
i created a job - myjob.
i created a step - step1
the step1 has operating system command: c:\myexe.exe
then i create a trigger on my table
CREATE TRIGGER MyTrigger1
ON testtable FOR INSERT
AS
EXEC sp_start_job @.job_name = 'myjob'
however when i add a row to the table i get this error:
[microsoft][odbc sql server driver][sql server] could not find stored
procedure 'sp_start_job'
this seems like a very basic problem.
why does it think i have a job sp_start_job. i thought sp_start_job just
kicks off the job?
thanks for any helpTry,
exec msdb.dbo.sp_start_job @.job_name = 'myjob'
AMB
"brian" wrote:
> hello,
> i am trying to create a job to execute an exe. i would like to kick off the
> job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>
>|||thanks. that got me a little further. but i see this now.
when i add my row i get the message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not
currently running so it cannot be notified of this action.
which is simular to if i go to the job ad click start. i get this message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not running
so it cannot be notified of this action.
is there something i have to set on the job to make it runnable? either
from sp_start_job or from "start job"?
thanks for the help
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
> Try,
> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>
> AMB
> "brian" wrote:
>> hello,
>> i am trying to create a job to execute an exe. i would like to kick off
>> the
>> job through a trigger. however i am running into some prblems.
>> i created a job - myjob.
>> i created a step - step1
>> the step1 has operating system command: c:\myexe.exe
>> then i create a trigger on my table
>> CREATE TRIGGER MyTrigger1
>> ON testtable FOR INSERT
>> AS
>> EXEC sp_start_job @.job_name = 'myjob'
>> however when i add a row to the table i get this error:
>> [microsoft][odbc sql server driver][sql server] could not find stored
>> procedure 'sp_start_job'
>> this seems like a very basic problem.
>> why does it think i have a job sp_start_job. i thought sp_start_job just
>> kicks off the job?
>> thanks for any help
>>
>>|||i think i have it.
you need to start the SQL Agent service.
"brian" <brian@.nospam.com> wrote in message
news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> thanks. that got me a little further. but i see this now.
> when i add my row i get the message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> currently running so it cannot be notified of this action.
> which is simular to if i go to the job ad click start. i get this
> message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> running so it cannot be notified of this action.
> is there something i have to set on the job to make it runnable? either
> from sp_start_job or from "start job"?
> thanks for the help
>
> "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>> Try,
>> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>>
>> AMB
>> "brian" wrote:
>> hello,
>> i am trying to create a job to execute an exe. i would like to kick off
>> the
>> job through a trigger. however i am running into some prblems.
>> i created a job - myjob.
>> i created a step - step1
>> the step1 has operating system command: c:\myexe.exe
>> then i create a trigger on my table
>> CREATE TRIGGER MyTrigger1
>> ON testtable FOR INSERT
>> AS
>> EXEC sp_start_job @.job_name = 'myjob'
>> however when i add a row to the table i get this error:
>> [microsoft][odbc sql server driver][sql server] could not find stored
>> procedure 'sp_start_job'
>> this seems like a very basic problem.
>> why does it think i have a job sp_start_job. i thought sp_start_job
>> just
>> kicks off the job?
>> thanks for any help
>>
>>
>|||You got it.
AMB
"brian" wrote:
> i think i have it.
> you need to start the SQL Agent service.
>
> "brian" <brian@.nospam.com> wrote in message
> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> > thanks. that got me a little further. but i see this now.
> > when i add my row i get the message:
> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> > currently running so it cannot be notified of this action.
> >
> > which is simular to if i go to the job ad click start. i get this
> > message:
> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> > running so it cannot be notified of this action.
> >
> > is there something i have to set on the job to make it runnable? either
> > from sp_start_job or from "start job"?
> >
> > thanks for the help
> >
> >
> >
> > "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> > message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
> >> Try,
> >>
> >> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
> >>
> >>
> >> AMB
> >>
> >> "brian" wrote:
> >>
> >> hello,
> >> i am trying to create a job to execute an exe. i would like to kick off
> >> the
> >> job through a trigger. however i am running into some prblems.
> >>
> >> i created a job - myjob.
> >> i created a step - step1
> >> the step1 has operating system command: c:\myexe.exe
> >>
> >> then i create a trigger on my table
> >> CREATE TRIGGER MyTrigger1
> >> ON testtable FOR INSERT
> >> AS
> >> EXEC sp_start_job @.job_name = 'myjob'
> >>
> >> however when i add a row to the table i get this error:
> >> [microsoft][odbc sql server driver][sql server] could not find stored
> >> procedure 'sp_start_job'
> >>
> >> this seems like a very basic problem.
> >> why does it think i have a job sp_start_job. i thought sp_start_job
> >> just
> >> kicks off the job?
> >>
> >> thanks for any help
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>|||Starting a job from a trigger? Sounds painful from a couple of stances.
What are you trying to accomplish?
Performance on your inserts is going to be horrible.
Only one copy of the job can be running at any time. If multiple insert
batches occur at nearly the same time one will fail.
The trigger will fire once for each insert batch not each row. This may or
may not be your intention.
"brian" <brian@.nospam.com> wrote in message
news:e45VUnpzFHA.2076@.TK2MSFTNGP14.phx.gbl...
> hello,
> i am trying to create a job to execute an exe. i would like to kick off
> the job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>|||And in addition, you need to execute sp_start_job in msdb:
EXEC msdb.dbo.sp_start_job ...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:3BAABBB2-27C5-4BB4-BEC3-CCE48CF6D6C7@.microsoft.com...
> You got it.
>
> AMB
> "brian" wrote:
>> i think i have it.
>> you need to start the SQL Agent service.
>>
>> "brian" <brian@.nospam.com> wrote in message
>> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
>> > thanks. that got me a little further. but i see this now.
>> > when i add my row i get the message:
>> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
>> > currently running so it cannot be notified of this action.
>> >
>> > which is simular to if i go to the job ad click start. i get this
>> > message:
>> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
>> > running so it cannot be notified of this action.
>> >
>> > is there something i have to set on the job to make it runnable? either
>> > from sp_start_job or from "start job"?
>> >
>> > thanks for the help
>> >
>> >
>> >
>> > "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
>> > message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>> >> Try,
>> >>
>> >> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>> >>
>> >>
>> >> AMB
>> >>
>> >> "brian" wrote:
>> >>
>> >> hello,
>> >> i am trying to create a job to execute an exe. i would like to kick off
>> >> the
>> >> job through a trigger. however i am running into some prblems.
>> >>
>> >> i created a job - myjob.
>> >> i created a step - step1
>> >> the step1 has operating system command: c:\myexe.exe
>> >>
>> >> then i create a trigger on my table
>> >> CREATE TRIGGER MyTrigger1
>> >> ON testtable FOR INSERT
>> >> AS
>> >> EXEC sp_start_job @.job_name = 'myjob'
>> >>
>> >> however when i add a row to the table i get this error:
>> >> [microsoft][odbc sql server driver][sql server] could not find stored
>> >> procedure 'sp_start_job'
>> >>
>> >> this seems like a very basic problem.
>> >> why does it think i have a job sp_start_job. i thought sp_start_job
>> >> just
>> >> kicks off the job?
>> >>
>> >> thanks for any help
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>

No comments:

Post a Comment