Round off difference - Sqlserver

General discussion forum about all databases other than SqlBase.
FRBhote
India
Posts: 2178
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Round off difference - Sqlserver

Post by FRBhote » 13 Mar 2021, 13:32

The statement

SELECT PTY, CITY, ROUND(PEAK *.5, 2), PEAKADJ
FROM U1.Z1
WHERE PEAKADJ > ROUND(PEAK * .5, 2) AND PTY = '32S1'

Gives 2024850.840 in Sqlserver Management Studio, but gives 2024850.83 in TD.

Why would this happen?
x.png
You do not have the required permissions to view the files attached to this post.

FRBhote
India
Posts: 2178
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Round off difference - Sqlserver

Post by FRBhote » 13 Mar 2021, 13:44

Same problem with TD 7.

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 260
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: Round off difference - Sqlserver

Post by thomas.uttendorfer » 15 Mar 2021, 07:52

Hi,
have you tried to replace :nFactor through 0.5 ?

Code: Select all

@ROUND(PEAK * .5, 2)
instead of

Code: Select all

@ROUND(PEAK * :nFactor, 2)
?
Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

FRBhote
India
Posts: 2178
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Round off difference - Sqlserver

Post by FRBhote » 17 Mar 2021, 12:21

Tried that - no difference:

!!CB!! 174
Set sSelect = "SELECT CITY, MARGINADJ, ( (PEAK* " || SalNumberToStrX( nFactor, 2 ) || ") ) - PEAKADJ
INTO :sCityCode, :nSpanMarginCollected, :nPeakShort
FROM " || sgSchema || "Z1
WHERE PTY = :sPartyCode AND CITY = :sCityCode AND PEAK - PEAKADJ > 0"
-------------------------
Evaluates to:
String: SELECT CITY, MARGINADJ, ( (PEAK* 0.50) ) - PEAKADJ
INTO :sCityCode, :nSpanMarginCollected, :nPeakShort
FROM U1.Z1
WHERE PTY = :sPartyCode AND CITY = :sCityCode AND PEAK - PEAKADJ > 0

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests