sql server - Getting wrong result when using bigint in sql query -


i have passed below amountdue in query getting wrong result. amountdue data type float.

amountdue: 2412880.28 amountdue: 561.06 

my query:

select convert(varchar,(select convert(bigint,amountdue*100))) dbo.tblbidresults 

i getting below results wrong:

241288027 56105 

correct result:

241288028 56106 

try converting numeric instead of bigint:

declare @temp float set @temp = 2412880.28 select convert(varchar,(convert(numeric(27,0),@temp*100))) 

there good post goes on reason here.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -