# How do you trim decimals in SQL?

Category:
technology and computing
web development

Overview of

The **SQL TRUNCATE**() function**TRUNCATE**() function returns n truncated to d

**decimal places**. If you skip d , then n is truncated to 0

**decimal places**. If d is a negative number, the function truncates the number n to d digits left to the

**decimal point**. The

**TRUNCATE**() function is supported by MySQL.

Also question is, how do you trim decimal places in SQL?

Overview of **SQL TRUNCATE**() function The **TRUNCATE**() function returns n truncated to d **decimal places**. If you skip d , then n is truncated to 0 **decimal places**. If d is a negative number, the function truncates the number n to d **digits** left to the **decimal** point. The **TRUNCATE**() function is supported by MySQL.

**SQL Server Decimal**

- p is the precision which is the maximum total number of decimal digits that will be stored, both to the left and to the right of the decimal point. The precision has a range from 1 to 38.
- s is the scale which is the number of decimal digits that will be stored to the right of the decimal point.

Correspondingly, how do you truncate decimals?

To **truncate** a number to 1 **decimal** place, miss off all the **digits** after the first **decimal** place. To **truncate** a number to 2 **decimal** places, miss off all the **digits** after the second **decimal** place.

The **TRUNCATE**() **function** truncates a number to the specified number of decimal places. Note: See also the FLOOR(), CEIL(), CEILING(), and ROUND() **functions**.