February 15, 2005 at 11:29 am
In MS Access I have a list box that has a list of dates in it, the user can select as many dates as he wants, and in any order
I take this date list in access and turn it into a WHERE IN clause like
WHERE [Period Date] IN (#02/01/05#,#02/02/05#,#02/05/05#,#02/07/05#,#02/10/05#,)
This gets data for dates selected.
In SQL server Dates are stored like '02/01/05 00:00:00.000'
How can the MS access In clause be repeated in SQL server with its date format. I know I can use julian dates, but what if that could not be done.
February 15, 2005 at 11:35 am
Read BOL on the CONVERT() function. Using a format code, you can convert [Period Date] into 'MM/DD/YYYY' format in the WHERE clause.
Psst - 2 digit years ? What about Y3K ?
February 15, 2005 at 12:34 pm
This convert function will remove the time element, ok great.
So I guess when you do JOINS on date feilds that the format must be exactly the same if you wish to join MM/DD/YYYY together ?
Yes I agree correct date format is MM/DD/YYYY
February 15, 2005 at 3:14 pm
Try this format and see if you like it.
SELECT CONVERT( varchar, GETDATE(), 101)
This will drop the time stamp element, hence when you use BETWEEN, you shouldn't have the problem of 12:00 AM versus 4:45 PM on the same day...
I wasn't born stupid - I had to study.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply