carlospro7

I'm trying to get the length of a number (the number of characters, or the number of digits plus the 1 period in a float number). The field that I'm using is of floats and when I use

field1 is a field of floats

When the number has more than 7 characters it doesn't count them.

I have also tried converting the floats to chars, but I get the same results. LEN(CONVERT(char(53),field)). I tried plugging different numbers in the char(), but nothing.

When I select whats in field1 I get the actual numbers, so I don't understand what's going on.

I also tried decimals instead of floats, but it includes the trailing zeros at the end depending on how many decimals i specify it to have. I don't want to use decimals though b/c the data in field1 may need to have different decimals places.

I tried DATALENGTH but that just returns 8 for every column regardless of how many digits field1 has.

I don't think any data is lost since when I select all rows in field1 (floats) the actual numbers are displayed. So if I insert the number 3333.123433 (which has 10 digits + period, length of 11) in field1, "3333.123433" is displayed after a selection and not "3333.12" which has has a length of 7.

Can someone explain whats going, or know a solution to this.

Thanks,

los

Code: |

SELECT field1, LEN(field1) length it returns the length but the most it goes is to 7. For example field1 | length ---------------------- 234.3 | 5 23 | 2 4333.1 | 6 44.31543 | 7 (this one should say 8) 1.00000002 | 7 (this one should say 10) 3333.123433 | 7 (this one should say 11) |

field1 is a field of floats

When the number has more than 7 characters it doesn't count them.

I have also tried converting the floats to chars, but I get the same results. LEN(CONVERT(char(53),field)). I tried plugging different numbers in the char(), but nothing.

When I select whats in field1 I get the actual numbers, so I don't understand what's going on.

I also tried decimals instead of floats, but it includes the trailing zeros at the end depending on how many decimals i specify it to have. I don't want to use decimals though b/c the data in field1 may need to have different decimals places.

I tried DATALENGTH but that just returns 8 for every column regardless of how many digits field1 has.

I don't think any data is lost since when I select all rows in field1 (floats) the actual numbers are displayed. So if I insert the number 3333.123433 (which has 10 digits + period, length of 11) in field1, "3333.123433" is displayed after a selection and not "3333.12" which has has a length of 7.

Can someone explain whats going, or know a solution to this.

Thanks,

los