| Author |
Topic |
|
landau66
Yak Posting Veteran
61 Posts |
Posted - 2009-02-12 : 08:37:29
|
| Hello!I have a table in which every column has the type nvarchar. In 4 of this columns i have values like 1,45682(=1.45682). I want to convert this to a double value. How can i achieve that?Many thanks and greetingsLandau |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-12 : 08:39:30
|
SELECT Col1, CASE ISNUMERIC(Col1) WHEN 0 THEN NULL ELSE CONVERT(FLOAT, Col1) ENDFROM Table1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-12 : 08:42:09
|
SELECT Col1, CASE ISNUMERIC(replace(Col1,',','.')) WHEN 0 THEN NULL ELSE CONVERT(FLOAT, replace(Col1,',','.')) ENDFROM Table1 |
 |
|
|
landau66
Yak Posting Veteran
61 Posts |
Posted - 2009-02-12 : 08:51:54
|
| well, that is not working. I get an error messages:Message 8114, Level 16, Status 5, Row 1I tried it also via the sqlserver management studio. I converted it and the result was that a 1,33055 became 133055,0000.Any ideas?Thanks, Landau |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-12 : 09:03:35
|
| show us the query that you ran. |
 |
|
|
landau66
Yak Posting Veteran
61 Posts |
Posted - 2009-02-12 : 09:09:51
|
| SELECT [Spalte 1], CASE ISNUMERIC([Spalte 1]) WHEN 0 THEN NULL ELSE CONVERT(FLOAT, [Spalte 1]) ENDFROM Test |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-12 : 09:23:51
|
| Try the query that I gave you. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-12 : 09:24:42
|
Try sakets suggestion with the REPLACE thingy... E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-12 : 09:24:54
|
 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
landau66
Yak Posting Veteran
61 Posts |
Posted - 2009-02-13 : 02:50:46
|
| Hi!Thanks a lot - it is working perfectly.Greetings, Landau |
 |
|
|
|