Re: HELP with DateAdd statement and SQL

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: robnson (stephen_at_ncsquare.com)
Date: 03/02/04


Date: 2 Mar 2004 09:18:59 -0800

Bob,

Thanks, for you help. Yes, I will need help with converting the time,
and help with adding that to my original script. Here is a sample of
my record in the TimeWritten field. ( 20040122164949.000000-480
)without the (). Also I am new to SQL, but you said just do a update
query and have a new column equal to the TimeWritten column? Again
thank you for all the help.

Steve Robinson

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:<uVK1KH9$DHA.220@TK2MSFTNGP09.phx.gbl>...
> robnson wrote:
> > Thank you Bob for you help, the datatype is set to char, but the
> > entries comes in with a UTC formatted time stamp. So I need to change
> > this to something else?
> >
> > I am importing event logs into a Database, and the time stamps comes
> > into the database as a UTC formated date and time, so I am trying to
> > take the current date, -1 which will be yesterday, converting that
> > date into a UTC formated Data and put it into my SQL Query as the
> > value in the table is > the converted date.
> >
> > I hope that makes since.
> >
>
> It makes sense, but it is going to be very difficult to achieve: you cannot
> do datetime comparisons with character data without converting the character
> data to datetime. While this may be possible, it will greatly deteriorate
> the performance of any query that you run agains the table, since the
> conversion function will need to be applied to every row in your table.
>
> I strongly suggest that you create a new column with datatype datetime and
> run an update query to set it equal to the date and time stored in your
> TimeWritten column.
>
> Do you need help with converting the UTC entries to datetime? If so, show me
> an example of one of the UTC entries and I'll show you how to do it.
>
> Bob Barrows



Relevant Pages

  • Re: HELP with DateAdd statement and SQL
    ... saying SQL that it is having a problem converting the charater set. ... > do datetime comparisons with character data without converting the character ... > the performance of any query that you run agains the table, ... > an example of one of the UTC entries and I'll show you how to do it. ...
    (microsoft.public.scripting.vbscript)
  • Re: Typed Dataset: Add expression-based column?
    ... Could you provide more clarity regarding how I would combine the datetime ... Microsoft MVP in VC++ ... Why this over the SQL select query that merges the two fields? ... "Conversion failed when converting datetime from character string" ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Typed Dataset: Add expression-based column?
    ... Why this over the SQL select query that merges the two fields? ... datetime field), I get an error at runtime complaining of a problem ... "Conversion failed when converting datetime from character string" ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: why this wont work!!??
    ... is used when evaluating the WHERE clause in the query to ... eliminate records that aren't included in the requested data set. ... > That's way I have used a subquery to avoid converting data like 'c*' ...
    (microsoft.public.access.queries)
  • Re: converting from varchar to datetime
    ... I Have just ran into the same problem converting a nvarchar to ... Example of incorrect information in your datebase: ... Arithmetic overflow error converting expression to data type datetime. ...
    (microsoft.public.sqlserver.programming)