-
date selection
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?
Thnx
-
date selection
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.
-
Re: date selection
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.
Thanks Oleg.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|