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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert time durations 1

Status
Not open for further replies.

Delphin

Programmer
Nov 27, 2001
134
US
I need to develop a stored procedure or view that will convert the time duration of several calls to seconds.

Here is what i am recieving:

Duration
00:02:30
00:10:01
00:03:29

I need to convert these to total number of seconds per call in the view so I can add these up in a SP or in crystal for a daily and MTD report on agent activity

Duration
150
6001
209

Billy Ballard

For in the past, Lies the future.
 
Code:
select cast(substring('00:02:30',1,2) as int)*3600+
cast(substring('00:02:30',4,2) as int)*60+
cast(substring('00:02:30',7,2) as int)

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Code:
   [Blue]SELECT[/Blue] [Fuchsia]DateDiff[/Fuchsia][Gray]([/Gray]ss[Gray],[/Gray]0[Gray],[/Gray][red]'00:02:30'[/red][Gray])[/Gray]
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
beautiful. TY

Billy Ballard

For in the past, Lies the future.
 
I'd say even a byte, except that I'd break my arm patting myself on the back. :)
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top