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.
Open SQL Server Management Studio.
Open a new query window.
Convert a floating-point number to an integer without rounding using the CAST() function by executing the following query statement, replacing "
Video of the Day
Convert and round a floating-point number to an integer using the CAST() function by executing the following query statement, replacing "