Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with integer conversion
Message
From
11/09/2013 21:51:41
 
 
To
11/09/2013 18:51:21
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 6.5 and older
Application:
Web
Miscellaneous
Thread ID:
01582916
Message ID:
01582930
Views:
44
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform