Re: Searching on DATETIME Fields

From: Keith (_at_.)
Date: 03/19/04


Date: Fri, 19 Mar 2004 14:44:24 -0000

Thank you

"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:uCoIaAcDEHA.3836@TK2MSFTNGP09.phx.gbl...
> Please check the article again. The datetime datatype does not store the
> values in any readable format. The format you see is created by the
> application with which you look at the data.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
>
> "Keith" <@.> wrote in message
news:eesLa4bDEHA.3584@TK2MSFTNGP11.phx.gbl...
> > I have seen that before, but my question is, why would passing
19/03/2004
> > 00:00:00 to a field of type datetime, which does contain values in this
> > format, fail?
> >
> > Surely passing the value is all that is required regardless of the
> datatype
> > as long as it matches the data contained in the field?
> >
> > "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote
> in
> > message news:eemPg0bDEHA.688@tk2msftngp13.phx.gbl...
> > > All you need at:
> > >
> > > http://www.karaszi.com/sqlserver/info_datetime.asp
> > >
> > > --
> > > Tibor Karaszi, SQL Server MVP
> > > http://www.karaszi.com/sqlserver/default.asp
> > >
> > >
> > > "Keith" <@.> wrote in message
> > news:uqwYixbDEHA.1544@TK2MSFTNGP09.phx.gbl...
> > > > I am fairly new to SQL so sorry if this is a really dumb question.
> > > >
> > > > I have a small (still) SQL database, which I am trying to query from
> an
> > > ASP
> > > > page.
> > > >
> > > > The field I am querying is of DATETIME data type, and is populated
> > > > automatically using the GetDate() function as a default value.
> > > >
> > > > When I try and search on this field, using a date/time in the format
> > > > dd/mm/yyyy hh:mm:ss as the search criteria, it fails with the
> following
> > > > error:
> > > >
> > > > [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a
> char
> > > data
> > > > type to a datetime data type resulted in an out-of-range datetime
> value.
> > > >
> > > > Can anyone tell me why this is? Surely if I am passing a value in
the
> > > > correct format for the data stored in the field it should work? Or
am
> I
> > > > missing something.
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Input Mask on Date for Year or Month Only
    ... Can I use an input mask to caputre only the year or only the month? ... If you wish to use the DateTime functions, ... A DateTime datatype value must be a valid date, ... format, the stored value must contain the day as well. ...
    (microsoft.public.access.gettingstarted)
  • Re: Get and update only Time part from DateTime data type field
    ... If the column is of the datetime datatype, then the above statement is incorrect. ... doesn't have a format, the client application formats the value. ... "Kumar" wrote in message ...
    (microsoft.public.sqlserver.programming)
  • Re: Syntax error converting Date time string?
    ... All assumes that L.Date_Last_Used is a datetime datatype column. ... "safe" format and a character string is implicitly converted to ... > Roji - thanks for the fast repsone, ... P. Thomas" wrote in message ...
    (microsoft.public.sqlserver.programming)
  • RE: datatype error
    ... or DATETIME datatype. ... and specify the format your string is in. ... I have code from an insert process that used the following SQL ... unfortunately the input data file no longer exists so I can't look at ...
    (perl.dbi.users)
  • Re: Mail Server for Solaris
    ... readable format. ... format for faster access? ... different when it comes to sendmail and cf and mc files. ... missing entries, to `dump' a Postfix DB file with db_dump, i.e.: ...
    (comp.unix.solaris)