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
 Transact-SQL (2005)
 convert duration field into minutes

Author  Topic 

ams006
Yak Posting Veteran

55 Posts

Posted - 2009-03-02 : 10:19:55
Hi All,

I have a field which records the duration of a phone call and want to convert it to show in seconds in the results.

Any ideas?

Cheers

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-02 : 10:38:00
whats the datatype of duration field?
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-03-02 : 10:40:00
how is the data stored?


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-02 : 10:46:41
if its of varchar format like '10:30:44'. then use like

LEFT(Col,CHARINDEX(':',Col)-1)*3600 + SUBSTRING(Col,CHARINDEX(':',Col)+1,2) * 60 + RIGHT(Col,2)*1
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-02 : 10:53:06
DATEDIFF(SECOND, 0, Col1)



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -