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 |
|
Asdzxc1986
Starting Member
14 Posts |
Posted - 2009-12-22 : 05:03:51
|
| need to convert datetime to float.how can I do it with convert function?DECLARE @SUM floatDECLARE @Unload_Time datetime??? I suppose it's incorrect, because doesn't give any results.UPDATE Route set SUM=convert(float, @Unload_Time, 120) where id<>0 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-12-22 : 05:14:50
|
UPDATE Routeset [SUM] = convert(float, @Unload_Time)where id <> 0 N 56°04'39.26"E 12°55'05.63" |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-22 : 05:16:31
|
HiYou expect this..?SELECT CAST(CONVERT(DATETIME, GETDATE(), 120) AS FLOAT)SELECT CAST(CONVERT(DATETIME, GETDATE(), 103) AS FLOAT) sorry i think no need to use convert-------------------------R... |
 |
|
|
Asdzxc1986
Starting Member
14 Posts |
Posted - 2009-12-22 : 05:30:57
|
How to write it?I suppose it's incorrect???Update ROUTE set SUM=CAST(CONVERT(DATETIME, @time_unload, 120) AS FLOAT) where id<>0quote: Originally posted by rajdaksha HiYou expect this..?SELECT CAST(CONVERT(DATETIME, GETDATE(), 120) AS FLOAT)SELECT CAST(CONVERT(DATETIME, GETDATE(), 103) AS FLOAT) sorry i think no need to use convert-------------------------R...
|
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-22 : 08:38:01
|
| Do it exactly like Peso showed you. Notice how he put [] around the word SUM? That tells SQL to use the column called SUM and not the SUM function. You may also need to put the table name in brackets as well.JimEveryday I learn something that somebody else already knew |
 |
|
|
Asdzxc1986
Starting Member
14 Posts |
Posted - 2009-12-22 : 08:47:05
|
| Thanks, it works!!! |
 |
|
|
|
|
|
|
|