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 - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2019
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
-
-
-
-
-
-
-
(Locked)
Use functions in T-SQL2m 47s
-
(Locked)
String functions3m 24s
-
(Locked)
Text concatenation3m 33s
-
(Locked)
Round with mathematical functions2m 46s
-
(Locked)
Work with date functions4m 53s
-
(Locked)
FORMAT date and times2m 59s
-
(Locked)
Return random records with NEWID2m 2s
-
(Locked)
The IIF logical function3m 9s
-
(Locked)
-
-
-
-
-