[dba-SQLServer] nevermind (Fw: conversion mystery)

Susan Harkins ssharkins at gmail.com
Wed Jan 16 13:11:24 CST 2008


Nevermind, as soon as I sent the message, the light went on!

Susan H.

----- Original Message ----- 
From: "Susan Harkins" <ssharkins at gmail.com>
To: "SQLList" <dba-SQLServer at databaseadvisors.com>
Sent: Wednesday, January 16, 2008 1:22 PM
Subject: conversion mystery


> The following expression
>
> SickLeaveHours/8
>
> returns whole numbers because SickLeaveHours is an int column -- at least, 
> I believe that's the reason.
>
> I've tried the following:
>
> CAST(SickLeaveHours/8 As decimal(6,4)) As SickHoursUsed
>
> but it still returns a whole value, just with four decimal places, all 
> sporting 0's. I've tried numeric, with the same results. I want this 
> expression to return valid decimal values -- for instance, 69/8 = 8.625. 
> I'm getting 8.0000
>
> Also, I'd really like to discuss this percision, scale business -- I don't 
> get it at all. I don't understand how the two interact -- for instance, in 
> the above decimal(5,4) returns an error, but 6,4 doesn't.
>
> Susan H. 




More information about the dba-SQLServer mailing list