Thanks so much for replying so quickly!
A1) I didn't know Sybase had a last_day function? I know Oracle has one where i would do
Ex: select * from MyTable where MyDate <= last_day(add_months(sysdat
--Would give me the last day of the previous month which is what i want to do the same in a sybase query.
A2) I never thought about using dateadd. Thanks! I will give this a try. Just a follow up question will this work also if I had to run this query next year feb. ... would i get jan04, dec03, nov03 ?
Main Topics
Browse All Topics





by: namasi_navaretnamPosted on 2003-12-21 at 16:09:47ID: 9982632
Q1) Isn't last date 12/31/YYYY always?
Ex: select * from MyTable where MyDate <= '12/31/2003'
Q2) Use DateAdd function with appropriate datepart?
DATEADD ( datepart , number, date )
number can be negative
Ex: select (mm, -1, GetDate())
HTH