You should specify the scale and precision for the decimal in the CAST
function, like this:
declare @test decimal(18,9)
SET @test = CAST('12.75' AS decimal(18,9))
PRINT @test
If you don't, SQL Server assumes that you want a decimal(18,0).
Razvan
wrote:
> declare @test decimal(18,9)
> SET @test = CAST('12.75' AS decimal)
> PRINT @test
>
> result = 13.00
>
> Why not 12.75, what am i doing wrong??
>> Stay informed about: why does CAST round