Datediff issue

rkrause

Registered User.
Local time
Yesterday, 23:50
Joined
Sep 7, 2007
Messages
343
I am using datediff to figure out the years of service for an employee. I am having trouble getting it to show decimals. with my current sql piece for this im just getting hole numbers.
Below is my code. If an employee has worked here under a year its giving them 1 year of service, i think its just rounding up to the next hole number.

what i would wnat is if an employee started on 7-1-2008 and quit 2-18-2010 he would have worked for 1.64 years.


atediff(d,upr00100.strtdate,getdate())/365'yrs of service'
 
From what I understand from how SQL handles calculations, if both numbers are whole number, then it returns a whole number. Thus if you tried 'datediff(d,upr00100.strdate,getdate())/365.00', then it might get what you want, otherwise you might enclosed the entire statement in a CONVERT statement.


Lots of luck.
 

Users who are viewing this thread

Back
Top Bottom