Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/Time Reporting: Stored Proc vs. Jobs

Status
Not open for further replies.

BlakeK

Programmer
Oct 1, 2001
59
US
I have a question about the reporting of the current date and time, and the length of time something takes to accomplish.

I have a Stored Procedure which has the following line at the top:
PRINT 'Started - ' + CONVERT(varchar(30), getdate())

The procedure then executes a series of queries, and whne it's done, the last line of the procedure is:
PRINT 'Finished - ' + CONVERT(varchar(30), getdate())

Then, I set up a Job to run this stored procedure on a regular interval. In the "Advanced" area of the "Step" section of the job, I set it to output the results of the job to a file.

Everything works great, but I have conflicts with the times being reported.
The output file shows the first line:
"Started - Jul 16 2004 12:00AM"
and the last line of the output file is:
"Finished - Jul 16 2004 12:04AM"

The date stamp of the output file is also Jul 16 2004 12:04AM

So, that means it took 4 seconds to run, right?

Well, when I go to the Job I setup, and look at the Job History, it says:
Run At: Jul 16 2004 12:00AM
Result: Successful
Run Duration: 00:00:37

37 seconds?

So, my question is, what is right? Have I done something wrong in my output string, or is the Job History reporting the duration incorrectly, or does the Job involve some overhead aside from the procedure it calls that makes it longer?

FYI, this is SQL2K Standard SP3.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top