Link to home
Start Free TrialLog in
Avatar of awalkinthepark
awalkinthepark

asked on

SQL not returning values that are in a table - datatype issue?

This statement returns all rows:
Select  column12 from mytable  

Column12  datatype is "real"

From this, I pick a random value from in the  rows returned:
for example,    -1.399726E+08  

copy an paste it into an this :
Select  column12 from mytable where column12 =-1.399726E+08

This returns a null,  no row found and returned

Is the query value  I'm seeing in the intial query,  ( -1.399726E+08 ) not exactly what's in the table?

What's going in here?
Thanks
Avatar of dsacker
dsacker
Flag of United States of America image

You should try the following:

1. Either, widen the column, so that you can see the entire number.
2. Or, convert it to a character, so you can see the entire number (if #1 does not work).

Select CONVERT(varchar(40), column12) AS column12 from mytable

Open in new window

This should be work like this as well

Select  column12 from mytable where column12 ='-1.399726E+08'
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of awalkinthepark
awalkinthepark

ASKER

thanks - works.