Re: SQL Between Dates



Thanks for your reply Roy, yes DateGiven is a datetime field type, hence the
reason I'm confused as to this not working? Is there any other reason that
I'd get 2003/2004/2005 dates listed? Is there a way that I can force SQL to
read the DateGiven field as a Date subtype? And perhaps force the input
dates to datetime format too?

Cheers, @sh


"Roy Harvey" <roy_harvey@xxxxxxxx> wrote in message
news:2frfg253eetd9cq4ben5b4vscvbjbtteu9@xxxxxxxxxx
Is DateGiven a datetime datatype? It sounds like it is a string, and
of course string comparison is from left to right, character by
character.

If you must store dates as strings - datetime is much better - the
safest way is yyyymmdd format. That is also the preferred format for
giving any date string to SQL Server as it avoids all the confusion of
October 9 vs September 10 that occurs when working internationally.

Roy Harvey
Beacon Falls, CT

On Wed, 13 Sep 2006 12:30:26 +0100, "@sh" <spam@xxxxxxxx> wrote:

An update actually, based on the SQL you suggested I am getting all
records
returned, with no filter - including dates from 2003, 2004 etc?

SELECT *
FROM sol_session
SELECT *
FROM SOL_Session
WHERE DateGiven >= '10/09/06' AND DateGiven
<= '13/09/06'

Any ideas?

Cheers, @sh


"@sh" <spam@xxxxxxxx> wrote in message
news:O9WdnXNmTY_5d5rYRVnyug@xxxxxxxxx
Ahhhhh sorry for being silly, knew it'd be something obvious, not having
a
good week!!!

Is it possible to use BETWEEN for such a SQL statement?

Cheers, @sh


"Roy Harvey" <roy_harvey@xxxxxxxx> wrote in message
news:eipfg21v7lgkd3nk8fg5ulg1jfou2ah43l@xxxxxxxxxx
On Wed, 13 Sep 2006 11:59:46 +0100, "@sh" <spam@xxxxxxxx> wrote:

WHERE DateGiven > '10/09/2006' AND <
'13/09/2006'

WHERE DateGiven > '10/09/2006'
AND DateGiven < '13/09/2006'

You need to specify DateGiven for each comparison.

Roy Harvey
Beacon Falls, CT





.



Relevant Pages

  • Re: OT BRoy, netcops and fuck Crap-zano
    ... Christian belief is the reason for Brandon's actions, but if it is he may ... Roy being forced into conformity by stirred up faux outrage is not a win for you. ... And maybe that doesn't strike you as a team leader thinking team, and being part of a team, but his teammates don't mind. ... I don't know if you have family in Iraq or in the hospital, but whatever the case, god bless. ...
    (alt.sports.basketball.nba.la-lakers)
  • Re: OT BRoy, netcops and fuck Crap-zano
    ... Christian belief is the reason for Brandon's actions, but if it is he may ... Roy being forced into conformity by stirred up faux outrage is not a win for you. ... And maybe that doesn't strike you as a team leader thinking team, and being part of a team, but his teammates don't mind. ... I don't know if you have family in Iraq or in the hospital, but whatever the case, god bless. ...
    (alt.sports.basketball.nba.la-lakers)
  • Re: OT BRoy, netcops and fuck Crap-zano
    ... and at least take the heat for the right reason. ... let Trail Blazer Roy have his moment of peace in peace. ... Shall I forward your post to Canzano? ... teammates don't mind. ...
    (alt.sports.basketball.nba.la-lakers)
  • Re: writing milliseconds to datetime database field
    ... Don't know if you caught the reason -why- we're using the datetime search ... >>I'm having a problem posting the milliseconds portion of a TDateTime ...
    (borland.public.delphi.database.ado)
  • Re: Speed up UDF
    ... for some reason that sounds painful. ... statement inline, which works nicely just takes up a lot more room in ... RETURNS datetime ...
    (comp.databases.ms-sqlserver)