RE: Sql Server Date problems
From: Evan Nelson (EvanNelson_at_discussions.microsoft.com)
Date: 12/06/04
- Next message: Louis Davidson: "Re: After deletion same records gets inserted"
- Previous message: SJ: "Re: SQLMail Issue - Not Running"
- In reply to: Alejandro Mesa: "RE: Sql Server Date problems"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 12:37:03 -0800
"SET DATEFORMAT dmy" should make it so that you don't have to use an
unambiguous date format in the SELECT statement.
It works for me so my bet would be that there is some sort of setting that
is overriding the SET DATEFORMAT. I'd really like to know what it is when
you find it.
"Alejandro Mesa" wrote:
> Try,
>
> SELECT project.id AS pid,* FROM project_date,project
> WHERE project_date.cms_id=project.cms_id AND project_date.dfrom<'20050601'
> AND project_date.dto>'20050601' ORDER BY strand,dfrom
>
>
>
> AMB
>
>
> "Mookoo" wrote:
>
> > Hi, this is one of those questions on dates. I'm completely stumped so any
> > help would be great. I'm querying the server with -
> >
> > SET DATEFORMAT dmy SELECT project.id AS pid,* FROM project_date,project
> > WHERE project_date.cms_id=project.cms_id AND project_date.dfrom<'1/6/2005'
> > AND project_date.dto>'1/6/2005' ORDER BY strand,dfrom
> >
> > the result set however returns for the 6th of january but I'm looking for
> > the 1st of June. If, however, I change the date to lets say 13/6/2005 -
> >
> > SET DATEFORMAT dmy SELECT project.id AS pid,* FROM project_date,project
> > WHERE project_date.cms_id=project.cms_id AND project_date.dfrom<'13/6/2005'
> > AND project_date.dto>'13/6/2005' ORDER BY strand,dfrom
> >
> >
> > then I get the correct date for the results - for the 13th of June 2005.
> > and so it goes for every month, anything below the 13th becomes read as mdy
> > whereas anything above the 12th gets read as dmy.
> >
> > This has me mystified so I'd be grateful for any advice/information
> >
> >
- Next message: Louis Davidson: "Re: After deletion same records gets inserted"
- Previous message: SJ: "Re: SQLMail Issue - Not Running"
- In reply to: Alejandro Mesa: "RE: Sql Server Date problems"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|