SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Confio Ignite

Using the TSQL Math Operators

TSQL has built in support for multiplication, division, addition, subtraction, and modulus. We'll show you how all those work and what happens with various data types, and we'll look at the order in which the operators are evaluated. Great lesson to make sure you know your options and get the correct answers when you do math in TSQL.

Duration:
6 mins 11 secs
Skill Level:
100
Rating:
4.29 out of 5
Publish Date:
November 20, 2010
Using the TSQL Math Operators You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of Andy Warren
Andy Warren is a software trainer focusing on SQL Server, a member of the PASS Board of Directors, and a principal in this site - SQLShare.com.

References



Comments
Mohamed Irshad on 11/21/2010
The "watch video now" in the below link is not opening the video. http://www.sqlshare.com/UsingtheTSQLMathOperators_854.aspx

Michael Miller on 11/22/2010
Author mentioned that the order of operation was Multiplication, Division, Addition, and Subtraction. He failed to mention that Multiplication and Division are equal in regards to order of precedence as are Addition and Subtraction and that evaluation is from left to right. It seems to be insinuated from the tutorial that Multiplication takes precedence over Division and Addition over subtraction, which is not the case.

Dennis Allen on 11/22/2010
Another common usage of the % operator is in base conversion functions.

Nilesh on 11/22/2010
Nice

Nilesh on 11/22/2010
Nice

Jack Pines on 11/22/2010
Bringing back the basics. Good job, Andy.

Jamshid Nouri on 11/22/2010
excellent demo of math operation

Don Nesbitt on 11/22/2010
Good review...easy if you know how to do it.

Derek on 11/22/2010
Great for beginners

James Brown on 11/22/2010
good succinct beginner tutorial

Joaquin Ortega on 11/22/2010
Include Div/ZERO handling

Camilo prado on 11/22/2010
very helpful Tuto.

7F718A6344 on 11/22/2010
select 7/2.0 returns the decimal without the big ol convert function

Michael Sidley on 11/22/2010
Well done but would have been nice if you addressed null values in source data

manjeet on 11/22/2010
Nice One

manjeet on 11/22/2010
Nice One

manjeet on 11/22/2010
Nice One

manjeet on 11/22/2010
Nice One

manjeet on 11/22/2010
Nice One

manjeet on 11/22/2010
Nice One

M McDonald on 11/23/2010
Multiplication and division are equal operators and are interchangeable select 5 * 4 / 2 - 1 + 9 select 4 / 2 * 5 - 1 + 9 Yield the same while forcing multiplication first select 4 / (2 * 5) - 1 + 9 does not

SQLSharma on 11/23/2010
Excellent SSRS example! Thanks Andy.

Mohamed Irshad on 11/25/2010
very nice

Leon on 1/29/2011
Useful, only order of operators not, because it is as expected

Maurice Ivory on 6/3/2011
I found alot of this information very useful.



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions