PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > Query a Table to return Non-Date values
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Query a Table to return Non-Date values

Réponse
 
LinkBack Outils de la discussion
Vieux 31/03/2008, 13h08   #1
Mike Fellows
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Query a Table to return Non-Date values

Hi

I have a table with dates stored in a nvarchar(75), I would like to move
this over to datetime (for obvious reasons)

the problem is the field has some 'bad data'

how can i query the nvarchar field to return me anything that isnt a date?
so i can fix and convert

Thanks in advance

Mike


  Réponse avec citation
Vieux 31/03/2008, 13h20   #2
Uri Dimant
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Query a Table to return Non-Date values

Mike
Take a look at ISDATE () function



"Mike Fellows" <mike.fellows@equityhouse.NO.SPAM.co.uk> wrote in message
news:KeadnZwJPKHNSW3anZ2dneKdnZydnZ2d@giganews.com ...
> Hi
>
> I have a table with dates stored in a nvarchar(75), I would like to move
> this over to datetime (for obvious reasons)
>
> the problem is the field has some 'bad data'
>
> how can i query the nvarchar field to return me anything that isnt a date?
> so i can fix and convert
>
> Thanks in advance
>
> Mike
>



  Réponse avec citation
Vieux 31/03/2008, 13h45   #3
Mike Fellows
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Query a Table to return Non-Date values

Uri,

I have been looking at that all morning and trying to understand it fully.

using the following query

SELECT MyDate, ISDATE(CommissionDate) AS Expr1 FROM MyTable

this returns a 1 or 0

the problem with ISDATE() is that it seems to rely on an american date
format

so 13/02/2003 is invalid whereas 02/13/2003 is valid

being in the UK the function appears to be as much use as a chocolate fire
guard

Thanks

Mike




"Uri Dimant" <urid@iscar.co.il> wrote in message
news:OTLvllykIHA.5660@TK2MSFTNGP02.phx.gbl...
> Mike
> Take a look at ISDATE () function
>
>
>
> "Mike Fellows" <mike.fellows@equityhouse.NO.SPAM.co.uk> wrote in message
> news:KeadnZwJPKHNSW3anZ2dneKdnZydnZ2d@giganews.com ...
>> Hi
>>
>> I have a table with dates stored in a nvarchar(75), I would like to move
>> this over to datetime (for obvious reasons)
>>
>> the problem is the field has some 'bad data'
>>
>> how can i query the nvarchar field to return me anything that isnt a
>> date? so i can fix and convert
>>
>> Thanks in advance
>>
>> Mike
>>

>
>



  Réponse avec citation
Vieux 31/03/2008, 13h51   #4
Mike Fellows
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Query a Table to return Non-Date values

the UK problem can be fixed by using

SET DATEFORMAT dmy;

- got it working now

Thanks again

Mike


"Mike Fellows" <mike.fellows@equityhouse.NO.SPAM.co.uk> wrote in message
news:UpudnVw4esuFQG3anZ2dnUVZ8v6dnZ2d@giganews.com ...
> Uri,
>
> I have been looking at that all morning and trying to understand it fully.
>
> using the following query
>
> SELECT MyDate, ISDATE(CommissionDate) AS Expr1 FROM MyTable
>
> this returns a 1 or 0
>
> the problem with ISDATE() is that it seems to rely on an american date
> format
>
> so 13/02/2003 is invalid whereas 02/13/2003 is valid
>
> being in the UK the function appears to be as much use as a chocolate fire
> guard
>
> Thanks
>
> Mike
>
>
>
>
> "Uri Dimant" <urid@iscar.co.il> wrote in message
> news:OTLvllykIHA.5660@TK2MSFTNGP02.phx.gbl...
>> Mike
>> Take a look at ISDATE () function
>>
>>
>>
>> "Mike Fellows" <mike.fellows@equityhouse.NO.SPAM.co.uk> wrote in message
>> news:KeadnZwJPKHNSW3anZ2dneKdnZydnZ2d@giganews.com ...
>>> Hi
>>>
>>> I have a table with dates stored in a nvarchar(75), I would like to move
>>> this over to datetime (for obvious reasons)
>>>
>>> the problem is the field has some 'bad data'
>>>
>>> how can i query the nvarchar field to return me anything that isnt a
>>> date? so i can fix and convert
>>>
>>> Thanks in advance
>>>
>>> Mike
>>>

>>
>>

>
>



  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 09h28.


É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,14003 seconds with 12 queries