To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
SQL CourseSQL Course
> Ask questions about the lessons on SQL Course 1 and 2. If you have problems
> with the interface, please post in the Feedback forum
When I query a table with a datetype field I get the date in european format (dd-mm-yy(yy)). However, whenever I try to make a selection using a comparison string in the WHERE clause like '22-09-2002' I get no results. When I change the string in the USA format (09-22-2002) it gives the expected results. Which config/installation setting governs this behaviour?
In situations like this you should use
'convert' function in WHERE clause
(See the description in SQL BOL).
If you write
convert(datetime, '22-09-2002', 105)
instead of
'22-09-2002'
you'll get the expected result, so you
may not be aware about the current date format settings.
Originally posted by Oleg Zernov In situations like this you should use
'convert' function in WHERE clause
(See the description in SQL BOL).
If you write
convert(datetime, '22-09-2002', 105)
instead of
'22-09-2002'
you'll get the expected result, so you
may not be aware about the current date format settings.