Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Error while casting to decimal! - response (7) by barani_sachin

$
0
0

Dieter,
    First i tried WHERE a25 <> cast(cast(a25 as varchar(100)) as dec(38,2)) and got so many rows as mismatch. And now i am more confused than ever. All the 0.00 columns have been converted to some random value (each 0.00 is converted into different random value - If sum1 has said to me dis s wat happening i wud hav laughed at them but believe me this s wat happening). I will try the remaining solution given by you later.
This s de query i tried


SEL a25,CAST(a25 AS VARCHAR(41)),CAST(CAST(a25 AS VARCHAR(100)) AS DECIMAL(38,2)) 
FROM TempUpdate 

I am putting first ten rows here

1 0.00 2.159999999999999946 2.16
2 1.00 1   1.00
3 0.00 9.9200000000000018 9.92
4 0.00 2.159999999999999946 2.16
5 0.00 1.339999999999999944 1.34
6 0.00 1.339999999999999944 1.34
7 1.00 1   1.00
8 0.00 14.919999999999999942 14.92
9 0.00 2.159999999999999946 2.16
10 1.00 1   1.00

 
Also while trying the below query

SEL a25,CAST(a25 AS VARCHAR(100)),CAST(CAST(a25 AS VARCHAR(100)) AS DECIMAL(38,2)) 
FROM TempUpdate
WHERE CAST(CAST(a25 AS VARCHAR(100)) AS DECIMAL(38,2)) <> a25

am getting some results in which both the columns are having same value(atleast to ma eyes!) but still am getting.

0.10 .100000000000001 0.10
-0.04 -.0399999999999987 -0.04
0.04 .0399999999999988 0.04

 
What am i missing here, i am completely lost?


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>