I have a table A , containing Column [GL_Amount] of datatype varchar GL_Amount contain following data :: -856.32 ,-261.60 ,-15.04 ,537.11
When I apply below query ::
Select Count(Cast(GL_Amount as Float)) From TableA
So, every time i run this query i get different result.
I need to correct this thing
You probbaly want to sum
.
Select SUM(Cast(GL_Amount as decimal(10,2)))
From TableA
And float
is inaccurate. Use a fixed-point data type like decimal . Or use an automatic conversion
Select SUM(GL_Amount * 1.0)
From TableA
TRY THIS
SELECT SUM(Convert(Money, GL_Amount)) GL_Amount
FROM TableA
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.