Trying build this some that it will return 24 months from the current day. What am I doing wrong??
SELECT TYPE,vendor,discontinueddate, datepart(quarter,[discontinueddate]) AS 'Quarter'from EOL WHERE DISCONTINUEDDATE <DateAdd("M",24,GETDATE())and (DISCONTINUEDDATE = '01/01/2005')Order by Discontinueddate
Thanks
For some reason that makes it go from 2003 - 2009
I need current day plus 24 months so I can show 8 quarters of info at a time.
Thanks for the help.
Mike
You say it goes from 2003 to 2009.
Run this:SELECT GETDATE()
That will show you what the server's date is set as. If you are getting 2009, it looks like your system date is off.
Note that Remi's suggestion does NOT have the quotes around the M in the DATEADD function, where yours did. Remi's is the correct way of doing it. If you want 24 months earlier than GETDATE(), use the -24 otherwise make it 24.
-SQLBill
I thought the same thing but it shows the correct date and time. It's my local PC<G>
Still getting a startdate of 2003 -24 and nothing on 24 or +24
The filed is a smalldatetime on SQL 2000 .
If I do WHERE (DISCONTINUEDDATE >= '01/01/2005') I get 01/01/2005 and up correctly as well.
Thanks for all of the help!!
Yes I was asking the same thing. I though I should start a new thread since it was somthing different.
I appologize if it offended someone.