Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transferring character field into numeric field
Message
De
22/10/2012 11:59:59
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01555436
Message ID:
01555460
Vues:
32
>It is possible. Simply use CASE statement, e.g.
>
> select case when MyColumnName NOT LIKE '%[^0-9]%' then 0 else convert(int, MyColumnName) END as Converted
>
>
>Also, in SQL 2012 you may want to look at TRY_CONVERT function.

Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform