Quantcast
Channel: Visual COBOL
Viewing all articles
Browse latest Browse all 5819

Forum Post: RE: Relativity and Linked Servers

$
0
0
There is a previous post about rounding errors in linked servers that I don't seem to be able to comment on anymore. community.microfocus.com/.../13179.aspx The suggested solution seems to be to cast it to a decimal in SQL -- which does not seem to be working.  Using the query... SELECT TOP 1 double_price, decimal_2_1_price, CONVERT(DECIMAL(2,1), decimal_2_1_price) decimal_2_1_price_post, decimal_3_2_price, CONVERT(DECIMAL(3,2), decimal_3_2_price) decimal_3_2_price_post, decimal_4_3_price, CONVERT(DECIMAL(4,3), decimal_4_3_price) decimal_4_3_price_post FROM OPENQUERY(data, ' SELECT CONVERT(1.555, SQL_DOUBLE) double_price, CONVERT(1.5, SQL_DECIMAL) decimal_2_1_price, CONVERT(1.55, SQL_DECIMAL) decimal_3_2_price, CONVERT(1.555, SQL_DECIMAL) decimal_4_3_price FROM some table here '); The results show... double_price: 1.555 -- correct, but an imprecise datatype decimal_2_1_price: 1.0 decimal_2_1_price_post: 1.0 decimal_3_2_price: 1.00 decimal_3_2_price_post: 1.00 decimal_4_3_price: 1.000 decimal_4_3_price_post: 1.000 Interestingly here, it is correctly interpreting the datatype, as shown by giving the correct number of zeros back for each result, just not giving the decimal values back in the results.  I have not been able to figure out the exact syntax for a CAST instead of convert.  But potentially this helps add some more information into this problem.

Viewing all articles
Browse latest Browse all 5819

Trending Articles



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