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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
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

Deepak ChauhanSQL Server DBACommented:
This should be work like this as well

Select  column12 from mytable where column12 ='-1.399726E+08'
Scott PletcherSenior DBACommented:
If you need to do equal comparisons against the value, you need to store is as decimal, not as real/float.  For example:

use tempdb

create table t1 (column12 real)
insert into t1 values(-1.399726E+08)
Select  column12 from t1 where column12 =-1.399726E+08 --no match found

create table t2 (column12 decimal(28, 6))
insert into t2 values(-1.399726E+08)
Select  column12 from t2 where column12 =-1.399726E+08 --match found

drop table t1
drop table t2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awalkintheparkAuthor Commented:
thanks - works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.