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 |
|
PHenry
Starting Member
10 Posts |
Posted - 2012-04-18 : 18:30:39
|
| One of the columns in a table is called productDelivered which uses the data type time(7); however, i would like to convert the time to seconds and keep it. I have around 50-60 records.Is there a way to change these times to seconds? I dont mind creating a new column in the table for productDeliveredSeconds but I thought maybe a stored procedure or a view might do it?The following was suggested but since new to the SQL language i dont actually understand how that relates with my column productDelivered and where the seconds are outputted to?TIME_TO_SEC(time)Returns the time argument, converted to seconds.mysql> SELECT TIME_TO_SEC('22:23:00'); -> 80580mysql> SELECT TIME_TO_SEC('00:39:38'); -> 2378 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
PHenry
Starting Member
10 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-04-18 : 18:54:20
|
SELECT DATEDIFF(SECOND, '00:00:00', '22:23:00'); N 56°04'39.26"E 12°55'05.63" |
 |
|
|
PHenry
Starting Member
10 Posts |
Posted - 2012-04-19 : 03:35:14
|
Could you explain how this works please?quote: Originally posted by SwePeso SELECT DATEDIFF(SECOND, '00:00:00', '22:23:00'); N 56°04'39.26"E 12°55'05.63"
|
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|
|