Urgent: Using decimal type | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Urgent: Using decimal type

Hi,
I have a problem that gives me quite a headache. I’m writing this code (simplified example): DECLARE @SumDECIMAL
SET @Sum = 88.5 SELECT @Sum This returns 89! How is that possible? Is there any way to get 88.5 by using CASTs, SET xxx, etc? I’m increasing a field in a table of type decimal and this gives me very strange errors… Thanks!
DECLARE @Sum DECIMAL(5,1)
SET @Sum = 88.5 SELECT @Sum You should give scale number too… see BOL…
MohammedU.
Moderator
SQL-Server-Performance.com
If you don’t specify a scale for a DECIMAL type, SQL Server will use a default type of DECIMAL(18,0). —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
]]>