convert varchar to date

  • Follow


I have a table that imports data from text files, and the dates come
in as YYYYMMDD into a varchar column.

I need to compare those dates to a column in an existing table that is
date format YYYY-MM-DD


I was thinking that CONVERT(DATETIME,temp_table_field) =
'existing_table_field'  but keep getting a syntax error.

0
Reply Steve 12/21/2007 2:23:03 PM

On 21 Dec, 14:23, Steve <steve.lo...@gmail.com> wrote:
> I have a table that imports data from text files, and the dates come
> in as YYYYMMDD into a varchar column.
>
> I need to compare those dates to a column in an existing table that is
> date format YYYY-MM-DD
>
> I was thinking that CONVERT(DATETIME,temp_table_field) =
> 'existing_table_field'  but keep getting a syntax error.

Is the column in the existing column a date column or a char/varchar
column containing a string representation of a date?

If it is the former, the date column does not have a format of YYYY-MM-
DD, it has MySQL's internal date format. It can however be viewed in
any number of formats.
0
Reply Captain 12/21/2007 2:44:32 PM


1 Replies
338 Views

(page loaded in 0.075 seconds)

Similiar Articles:













7/26/2012 4:51:07 PM


Reply: