PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > convert varchar to date
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
convert varchar to date

Réponse
 
LinkBack Outils de la discussion
Vieux 21/12/2007, 14h23   #1
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut convert varchar to date

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.

  Réponse avec citation
Vieux 21/12/2007, 14h44   #2
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: convert varchar to date

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h59.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,49493 seconds with 10 queries