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 |
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-04-07 : 09:06:04
|
| Hello,I am having trouble converting a varchar column of length 255 into a float datatype. I am using alter table to add a new column of type float and I'm then selecting the contents of the old varchar column into it, using convert in the process like so:alter table mytableadd newcolumn float nullupdate mytableset newcolumn = convert(float, oldcolumn)But I get the following error message:Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to float.Does anyone have any ideas what I may be doing wrong here? Many thanks in advance for any help. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-04-07 : 09:32:21
|
| Make sure that oldcolumn does not have any non numeric charatersMadhivananFailing to plan is Planning to fail |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-04-07 : 09:33:02
|
| You've got data in your oldColumn that can't convert. see which they are with:Select oldColumn from myTable where isNumeric(oldColumn) = 0Be One with the OptimizerTG |
 |
|
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-04-07 : 09:33:22
|
| Just checked, that was it. Can't believe that eluded me. Thanks! |
 |
|
|
|
|
|