Paul White NZ (5/4/2010)
Hugo Kornelis (5/4/2010)
Here is another repro that runs fine on all clients, to demonstrate that SQL Server itself actually does not have any issues with this code:
-- Or, the more direct approach
SELECT CAST(ROUND(0.5,0) AS decimal(12,2));
According to Jim Hogg (MSFT) on Connect, the error is raised by SQL Server, and is By Design:
Good find, Paul.
But Jim is wrong. If his explanation was correct, thanDECLARE @x numeric(2,1); SET @x = ROUND(9.5,0);
should return an error, on all clients. It does not. ButDECLARE @x numeric(2,1); SET @x = ROUND(9.5,0); SELECT @x;
does return an error, on some clients.