Fungsi SQL Server ROUND()
Contoh
Bulatkan angka menjadi 2 tempat desimal:
SELECT ROUND(235.415, 2) AS RoundValue;
Definisi dan Penggunaan
Fungsi ROUND() membulatkan angka ke sejumlah tempat desimal yang ditentukan.
Tip: Lihat juga fungsi FLOOR() dan CEILING() .
Sintaksis
ROUND(number, decimals, operation)
Nilai Parameter
Parameter | Description |
---|---|
number | Required. The number to be rounded |
decimals | Required. The number of decimal places to round number to |
operation | Optional. If 0, it rounds the result to the number of decimal. If another value than 0, it truncates the result to the number of decimals. Default value is 0 |
Detail Teknis
Bekerja di: | SQL Server (dimulai dengan 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Lebih Banyak Contoh
Contoh
Bulatkan angka menjadi 2 tempat desimal, dan gunakan juga parameter operasi :
SELECT ROUND(235.415, 2, 1) AS RoundValue;
Contoh
Bulatkan angka ke -1 tempat desimal:
SELECT ROUND(235.415, -1) AS RoundValue;