How to Convert Doubles to Integers in SQL

Double-precision floating point numbers are represented by the "float" data type in SQL Server. Occasionally, it may be necessary to convert a floating point number to an integer. This is achieved through the use of the T-SQL "CAST()" function. The "CAST()" function will not automatically round decimals up or down but can be combined with the T-SQL "ROUND()" function if rounding is desired.

...
Currency is an example of a floating-point number.

Step

Open SQL Server Management Studio.

Step

Open a new query window.

Step

Convert a floating-point number to an integer without rounding using the CAST() function by executing the following query statement, replacing "" with any floating point number:

Step

SELECT CAST(AS INT)

Step

Convert and round a floating-point number to an integer using the CAST() function by executing the following query statement, replacing "" with any floating point number:

Step

SELECT CAST(ROUND(CAST(AS DECIMAL(10,3)), 0) AS INT)