# How to Convert Doubles to Integers in SQL

Techwalla may earn compensation through affiliate links in this story.
Currency is an example of a floating-point number.

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.

## Step 1

Open SQL Server Management Studio.

Video of the Day

## Step 2

Open a new query window.

## Step 3

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:

SELECT CAST( AS INT)

## Step 4

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:

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

#### Tip

The "CONVERT()" function can be substituted for "CAST()", if preferred.

#### Warning

The "ROUND()" function returns a numeric data type. If you do not cast the float as a decimal within the function call, an arithmetic overflow error can occur in certain situations when the rounded number results in more digits than the original argument.

Attempting to convert a number less than -2,147,483,647 or greater than 2,147,483,647 will result in an arithmetic overflow error because the number is outside the range of the integer data type.