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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-24 : 08:53:30
|
Hi,I would like to insert the following figures (which are held in a varchar(50) datatype field) into a field of type decimal(24, 4)5.55111512312578e-0174.00000000020384e-0054.99999999981071e-0051.38777878078145e-017How can I do this please? |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-24 : 08:55:33
|
When usingconvert(decimal(24, 4), [Column 9])the error is:Error converting data type varchar to numeric. |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-24 : 09:21:03
|
Found what causes the error:I think it is to do with the fact that one row contains '1e-006'and when running the following query the error is produiced.error:Error converting data type varchar to numeric.What is wrong with this number though?select convert(decimal(24, 4), '1e-006') |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2007-07-24 : 09:59:49
|
Most of these are basically zeroes, and SQL can't convert them into NUMERIC(p,s) because it doesn't have the precision. If you do select convert(decimal(38, 37),convert(real, [col9]))you will see that all of your answers are < .000001, which are all 0.0000 in decimal(24,4)Jim |
 |
|
|
|
|
|
|