Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL Server Agent

Author  Topic 

Lilian
Starting Member

5 Posts

Posted - 2007-11-29 : 03:04:40
I have set up a job under SQL server Agent to execute a stored procedure that will update a table in my database.

I set the job to run after the SQL Server Agent starts. According to the job history, the job ran successfully but there was no updated record in my table. However, if I manually restart then SQL Server Agent, the table is updated.

Is is something wrong with the SQL Server Agent or must the job be run twice for it to update?

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-29 : 03:39:46
It should run straight away, can you post the statement you are trying to run?
Go to Top of Page

Lilian
Starting Member

5 Posts

Posted - 2007-11-29 : 03:48:09
Its only involves 1 step to execute the stored procedure:
exec sp_DailySales

There is no problem with the sp as it runs perfectly when I execute it manually.

Go to Top of Page

dirtydavey
Yak Posting Veteran

80 Posts

Posted - 2007-11-29 : 09:16:10
Does it run fine when you run the job manualy?

Dave Dunckley says there is a law for the rich and a law for the poor and a law for
Dirty Davey.
Go to Top of Page

Lilian
Starting Member

5 Posts

Posted - 2007-11-29 : 20:07:46
Yes, it runs fine. I'm using this to update the sales record for a few branches. A few of the branches work ok but majority is still having problems. The settings for the job is the same and put the job owner to be sa, so there should be no privileges issue.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-30 : 02:31:22
Set profiler trace then run the job again to check what's the problem.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-30 : 03:40:25
quote:
Originally posted by Lilian

Yes, it runs fine. I'm using this to update the sales record for a few branches. A few of the branches work ok but majority is still having problems. The settings for the job is the same and put the job owner to be sa, so there should be no privileges issue.


Unless the SP also writes/reads from a network share.
Go to Top of Page

Lilian
Starting Member

5 Posts

Posted - 2007-11-30 : 04:50:26
How do I set the profiler trace?

This SQL Server Agent is making me confused and I don't know what is wrong. Like I said before, I set the job to run when the SQL Server Agent starts. It runs successfully (according to the job history) but no record update. But if I manually stop and restart the SQL Server Agent, the job will run again but this time it provides the desired output and update the record.

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-12-02 : 01:03:34
Check books online for setting profiler.
Go to Top of Page
   

- Advertisement -