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.
| Author |
Topic |
|
TheMilkMan
Starting Member
10 Posts |
Posted - 2002-12-11 : 03:56:53
|
| Hi all,i have a text field which is really a time field, how do i convert it to seconds only, the data is in this format 123:34 i would like it to be 7414, any help would be greatful, been trying for ages, thanks inadvance.jd// SlowlyGetting There // |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2002-12-11 : 04:24:39
|
| select (cast (left ('123:34',(len('123:34')-3)) as int)) * 60 + (cast (right ('123:34',2) as int))This relies on the format always having two characters after the :, otherwise you would have to look for the : in the string to use as the position marker.Obviously replace '123:34' with the field name from the table...-------Moo. |
 |
|
|
TheMilkMan
Starting Member
10 Posts |
Posted - 2002-12-11 : 07:53:04
|
| thanks for that seams to work a treatjd// SlowlyGetting There // |
 |
|
|
|
|
|