Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with integer conversion
Message
De
11/09/2013 21:51:41
 
 
À
11/09/2013 18:51:21
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 6.5 and older
Application:
Web
Divers
Thread ID:
01582916
Message ID:
01582930
Vues:
43
Don,

Exactly as Charles said, you want to round the number to get rid of decimals. The integer data type is constrained to only store whole numbers.

Just to demonstrate in SSMS: This won't work...
SELECT CAST( '123.45' AS INT)  -- GENERATES AN ERROR
But this will work:
SELECT CAST(  ROUND('123.45',0) AS INT)   -- GENERATES 123
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform