SQL Server ROUND() Function Last Updated : 17 Jun, 2024 Comments Improve Suggest changes Like Article Like Report The SQL Server ROUND() function rounds off a specified number to a decimal place. If the length is negative and larger than the number of digits before the decimal point, ROUND returns 0. ROUND in SQL ServerThe ROUND() function in SQL Server rounds off a number to a specified decimal place. It accepts positive, negative, and zero values. This function always returns the number after rounding to the specified decimal places. SyntaxThe ROUND function syntax is: ROUND(number, decimals, operation) Parameters This method accepts three parameters, as given below : number: The specified number to be rounded off. decimals: A specified number of decimal places up to which the given number is to be rounded. operation: This is an optional parameter. If its value is 0, it rounds the result to the number of decimals. If another value is greater than 0, it truncates the result to the number of decimals. The default value is 0 SQL Server ROUND Function ExamplesLet's look at some example of the ROUND function in SQL Server. Example 1:In this example, we are rounding off a number up to next two decimal places. Query SELECT ROUND(12.3456, 2);Output : 12.3500Example 2:In this example, we are rounding off the number to the next two decimal places with the operational parameter 1 which says only to truncate the specified number (-23.456) to the given decimal places i.e., 2. Query: SELECT ROUND(12.3456, 2, 1);Output : 12.3400Example 3: In this example, we are using ROUND() function with negative paramter. Query: DECLARE @Parameter_Value FLOAT;SET @Parameter_Value = -2;SELECT ROUND(123.4567, @Parameter_Value);Output : 100.0000Example 4: In this example, we are rounding number to the zero number of decimal places. Query: SELECT ROUND(123.467, 0);Output : 123.000Important Points About SQL Server ROUND FunctionThe ROUND() function in SQL Server is used to round off a specified number to a specified number of decimal places.It accepts various types of numbers, including positive, negative, and zero.The return type of the ROUND() function depends on the input number type.The ROUND() function uses the rounding-to-the-nearest-digit algorithm. Comment More infoAdvertise with us Next Article SQL Server ROUND() Function K Kanchan_Ray Follow Improve Article Tags : SQL DBMS-SQL SQL-Server Similar Reads SQL Server RAND() Function The RAND() function in SQL Server generates pseudo-random floating-point numbers within the range of 0 (inclusive) and 1 (exclusive). It is a function that can produce different random values each time it is called unless a specific seed is provided which results in a repeatable sequence of numbers. 3 min read SQL Server LEN() Function SQL SERVER LEN() function calculates the number of characters of an input string, excluding the trailing spaces. LEN() Function in SQL ServerThe LEN function in the SQL Server fetches the number of characters in a string. It counts the preceding spaces but not the trailing spaces. For eg, 'SQL SERVE 2 min read RANK() Function in SQL Server The RANK() function is a powerful window function in SQL Server used to assign a rank to each row within a result set. It is particularly useful when we need to assign a rank to a group of rows based on some sorting criteria and want to differentiate between rows that have the same values. Unlike ot 5 min read SQL Server POWER() Function The POWER() function in SQL Server is a mathematical function that computes the result of raising a number (the base) to the power of another number (the exponent). It is a versatile function used for various calculations, such as squaring a number, computing roots or applying exponential growth in 3 min read SQL Server NTILE() Function SQL NTILE() function is a window function that distributes rows of an ordered partition into a pre-defined number of roughly equal groups. NTILE() Function in SQL ServerThe NTILE() function in SQL server is used to distribute rows of an ordered partition into a specified number of approximately equa 3 min read MONTH() Function in SQL Server MONTH() function : This function in SQL Server is used to return the month of the year i.e, from 1 to 12 for a date stated. Features : This function is used to find the month of the year for a date specified. This function comes under Date Functions. This function accepts only one parameter i.e, dat 2 min read STR() Function in SQL Server The STR() function converts a numeric value to a character value. Syntax : STR(float_expression [, length [, decimal]]) Parameter : This method accepts three parameters as mentioned above and described below : float_expression : It is a numeric expression that evaluates to an approximate number with 1 min read LOG() Function in SQL Server The LOG() function returns the logarithm of a specified number or the logarithm of the number to the specified base. Syntax : LOG(number, base) Parameter : LOG() function accepts two-parameters as mentioned above and described below. number - This parameter hold a number which is greater than 0. bas 1 min read SUM() Function in SQL Server The SUM() function in SQL Server is an essential aggregate function used to calculate the total sum of values in a numeric column. It aggregates data by summing up all values in the specified column for the rows that match the criteria of the query.In this article, We will learn about SUM() Function 3 min read MIN() Function in SQL Server MIN() : This function in SQL Server is used to find the value that is minimum in the group of values stated. Features : This function is used to find the minimum value.This function comes under Numeric Functions.This function accepts only one parameter namely expression. Syntax : MIN(expression) Par 2 min read Like