Re: transact-sql datediff function

2002-05-07 Thread Dina Hess
to summarize, the following transact-sql code is touted by "The Guru's Guide to Transact-SQL" as the best solution to return only those employees whose hire date anniversaries fall within the next 30 days: select fname, lname, hire_date from employees where datediff (yy, hire_date, getdate()) +

RE: transact-sql datediff function

2002-05-07 Thread Bill Grover
Sent: Monday, May 06, 2002 2:20 PM > To: CF-Talk > Subject: OT: transact-sql datediff function > > > hi all, > > i posted this on the sql list but got no response. > > i have a test table named employees with the following fields: > > fname varchar > l

RE: transact-sql datediff function

2002-05-06 Thread Ryan Pieszak
ays), it works. Let me know if it works for you. I'm leaving for the day, I'll check my mail in the morning. Ryan -Original Message- From: Dina Hess [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 5:16 PM To: CF-Talk Subject: Re: transact-sql datediff function well, h

RE: transact-sql datediff function

2002-05-06 Thread Costas Piliotis
ginal Message- From: Dina Hess [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 1:17 PM To: CF-Talk Subject: Re: transact-sql datediff function thanks for taking a look at it, margaret. but the whole idea is that i'm trying to find the difference (in years) between the hire date a

Re: transact-sql datediff function

2002-05-06 Thread Dina Hess
work as expected: select fname, lname, hire_date from employees where datediff (yy, hire_date, getdate()) + 30) > datediff (yy, hire_date, getdate()) maybe i'm doing something stupid. does this code work for you? ~ dina - Original Message - From: "Ryan Pieszak" <[EMAI

RE: transact-sql datediff function

2002-05-06 Thread Ryan Pieszak
: Monday, May 06, 2002 4:17 PM To: CF-Talk Subject: Re: transact-sql datediff function thanks for taking a look at it, margaret. but the whole idea is that i'm trying to find the difference (in years) between the hire date and today's date. ~ dina - Original Message - From: "

Re: transact-sql datediff function

2002-05-06 Thread Dina Hess
ROTECTED]> Sent: Monday, May 06, 2002 2:56 PM Subject: RE: transact-sql datediff function > Just a guess, but in the datediff you are just extracting the year. If you > want to include the > month in the calculation, you should probably get the month part too. > > Margaret > &

RE: transact-sql datediff function

2002-05-06 Thread Margaret Fisk
Subject: OT: transact-sql datediff function hi all, i posted this on the sql list but got no response. i have a test table named employees with the following fields: fname varchar lname varchar hire_date datetime the record i'm querying contains 2001-05-11 00:00:00.000 in the hire_date

OT: transact-sql datediff function

2002-05-06 Thread Dina Hess
hi all, i posted this on the sql list but got no response. i have a test table named employees with the following fields: fname varchar lname varchar hire_date datetime the record i'm querying contains 2001-05-11 00:00:00.000 in the hire_date field. but this query returns 1 rather than the exp