Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 That old favourite Datetime

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-28 : 08:17:14
Gordon writes "I'll cut to the chase, assuming that the field POST_DATE is a datetime, i am trying to select using the following (in UK Format) - i know it works fine in US m/d/yy format but thats not really any use.

This works fine...
Convert(Varchar(12),dbo.TRADPOST.POST_DATE),103)Between '01/01/2002' AND '03/26/2002'

Whereas this doesn't - any ideas???...
Convert(Varchar(12),dbo.TRADPOST.POST_DATE),103)Between '01/01/2002' AND '26/03/2002' "

davidpardoe
Constraint Violating Yak Guru

324 Posts

Posted - 2002-03-28 : 08:31:41
Could be what the DATEFORMAT setting is for your server. I think your string in your BETWEEN clause is being converted using what the DATEFORMAT is set as. I don't think the convert on POST_DATE is necessary.

Set the DATEFORMAT explicitly using:-

SET DATEFORMAT dmy





============================
Chairman of
The NULL Appreciation Society
"Keep NULLs as NULL"
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-03-28 : 08:38:22
Change the style from 103 to the appropriate one(Dont have BOL with me rite now). check for style and select the appropriate format no.



--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -