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 2000 Forums
 SQL Server Development (2000)
 calculate time

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2005-07-06 : 14:16:37
Hi All.
The Table1 has StartDate, EndDate , ExecTime fields and I would like to create a function in SQL Server 2000 to calculate a time execution. If time execution more than 24 hours the format's result should be DAY-HR-MIN-SEC. The result will keep in the Table1. How to create such function?
Thanks.

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-07-06 : 14:43:16
difference should be kept in the smallest unit you want to measure (aka seconds)

display is not how you should store it, that is a presentation layor task.

so the execTime would be:

execTime = datediff(ss,startdate,enddate)

display can be figured using modulo (%)... there are plenty of examples out here, so I'm not going to type one out again...

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page
   

- Advertisement -