Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Varchar to int
Message
 
 
À
20/09/2004 10:38:27
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00944009
Message ID:
00944013
Vues:
16
You can check for '.' in the string
CASE CHARINDEX('.', answer) > 0 THEN --- real
>I have a table having a field called 'answer' is Varchar. We need change all values to Int.
>
>678 TO 678 (INT to INT don't change)
>Y TO 1
>N TO 0
>5.56 TO 556 (Real to INT by time 100, this is price)
>
>I used
>
>questionresponse=
>case
> when isnumeric(answer)=1 then answer -- need change
> when isnumeric(answer)=0 and answer= 'Y' then '1'
> when isnumeric(answer)=0 and answer= 'N' then '0'
> when isnumeric(answer)=0 and answer= '-' then '0'
>end
>
>The only thing is how can we figure out which one is real. Do we have the function to identify Int and Real like isreal?
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform