October 11, 2010 at 4:09 am
I have to set up a SQL Script that extracts the appointment data I need for 7 days from now.
I am running the following SQL for the select having to manually enter the date 7 days from now
(vw_Ixp_appointments.appdate_dte >= '2010-10-18 00:00')
AND (vw_Ixp_appointments.appdate_dte <= '2010-10-18 23:59')
I know that I can also run the following but it doesn’t return any results….
(vw_Ixp_appointments.appdate_dte = (GETDATE () +7))
Question is how can the above be modified (if possible) to accommodate the date format our data uses or am I doing something wrong?
October 11, 2010 at 4:14 am
October 11, 2010 at 4:22 am
Hi ,
please see this article , essential reading imo
October 11, 2010 at 4:43 am
Sorted now, Cheers
October 11, 2010 at 5:02 am
If appdate_dte is a datetime column, the date format is irrelevant. You'll be comparing a date with a date, no formatting applies.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply