i finally got msde installed along with the query analyzer that i
pulled off a trial version. but as a 'newbie' to sql, i'm stumped
by the following inconsistent results.

here's the sql:

select datediff(yy,hire_date,getdate()+30)from employees
select datediff(yy,hire_date,getdate())from employees
select datediff(yy,2001-05-11,(2002-05-04)+30)
select datediff(yy,2001-05-11,2002-05-04)

and here are the results:
----------
1
1
1

(3 row(s) affected)


-----------
1
1
1

(3 row(s) affected)


-----------
0

(1 row(s) affected)


-----------
0

(1 row(s) affected)

dates in each of the three records in the employee table are
datetime data type and contain the following information:

2001-03-31 00:00:00.000
2001-01-25 00:00:00.000
2001-05-11 00:00:00.000

the only sql that gives the expected result is the last one. i
don't get it.

would one of you sql gurus mind shedding some light on this for
me?

~ dina

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to