>Sai qualche altro stratagemma ?
E se provassi a sottrarre 1 millesimo?
USE tempdb;
GO
CREATE TABLE dbo.Numbers(
Number decimal(5, 3) NOT NULL
);
GO
INSERT dbo.Numbers VALUES(16.350);
INSERT dbo.Numbers VALUES(16.351);
INSERT dbo.Numbers VALUES(16.352);
INSERT dbo.Numbers VALUES(16.353);
INSERT dbo.Numbers VALUES(16.354);
INSERT dbo.Numbers VALUES(16.355);
INSERT dbo.Numbers VALUES(16.356);
INSERT dbo.Numbers VALUES(16.357);
INSERT dbo.Numbers VALUES(16.358);
INSERT dbo.Numbers VALUES(16.359);
INSERT dbo.Numbers VALUES(16.360);
GO
SELECT
Number
, CAST(Number - 0.001 AS decimal(4, 2)) AS Arrotondamento1
, ROUND(Number - 0.001, 2) AS Arrotondamento2
FROM dbo.Numbers;
GO
/* Output:
Number Arrotondamento1 Arrotondamento2
------- ---------------- ----------------
16.350 16.35 16.350
16.351 16.35 16.350
16.352 16.35 16.350
16.353 16.35 16.350
16.354 16.35 16.350
16.355 16.35 16.350
16.356 16.36 16.360
16.357 16.36 16.360
16.358 16.36 16.360
16.359 16.36 16.360
16.360 16.36 16.360
(11 row(s) affected)
*/
DROP TABLE dbo.Numbers;
>Ciao e grazie ancora.
Prego.
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
http://italy.mvps.org