From the course: Querying Microsoft SQL Server 2019

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Round with mathematical functions

Round with mathematical functions - SQL Server Tutorial

From the course: Querying Microsoft SQL Server 2019

Start my 1-month free trial

Round with mathematical functions

- [Instructor] Mathematical functions process input values and return a single numeric value. I'm going to write a quick query here that pulls out the BusinessEntityID and SalesYTD columns from the Sales.SalesPerson table. This will give us some numerical values that we can play around with. Now there's a couple of different mathematical functions that'll round values in different ways that I want to demonstrate. The basic round function takes two arguments. The first argument is the data that you want to round. I'm going to process the SalesYTD column here. The second argument specifies the length, or the precision, of the rounding. Positive integers represent the number of decimal positions and negative integers represent the number of digits to the left of the decimal. I'm going to write this out two different ways so you can see the difference. The first will be a positive two, and I'll name this as Round2. Then…

Contents