I went below AmountDue in the request, but getting the wrong result. The AmountDue data type is Float.
AmountDue: 2412880.28 AmountDue: 561.06
My request:
select CONVERT(varchar,(select convert(bigint,AmountDue*100))) from dbo.tblBidResults
I get below results that are incorrect:
241288027 56105
The correct result is:
241288028 56106
try converting to a numeric value instead of bigint:
DECLARE @temp float set @temp = 2412880.28 SELECT CONVERT(varchar,(CONVERT(numeric(27,0),@temp*100)))
There is a good post that explains the reason for this here.
DECLARE @temp float set @temp = 2412880.28 select convert(varchar,convert(decimal(9,0),@temp*100))
SQL FIDDLE
Source: https://habr.com/ru/post/1479817/More articles:In the source files of the Eclipse plug-in, why are there so many variables with the prefix "f"? - javaThe problem of comparing two directories - c #unit unit testing with event and delegate - c #Kernel panic: trying to write / read on a small tty driver - linux-kernelGetting the error "array bound is not an integer constant up to ']' token" - c ++Python if-else nested instructions - pythonHow can I take a Java set to fit X and split X / Y sets? - javaRavenDB periodic backups: how can I โclear the bookโ and force a full backup? - database-backupsWhy does MATLAB change the sampling rate when trying to get data? - sampleInfinite scroll does not work in AngularJS when scrolling over ng-view - angularjsAll Articles