This is a quick review, which will lead up to addressing Division by Zero errors in SQL Server.
dividend ÷ divisor = quotient
Division is a way of splitting objects into equal groups.
12/12 = 1 Distribute 12 items into trays that can hold 12 items at a time.
12/6 = 2
12/3 = 4
12/1 = 12
12/0 = ? looking at the pattern as the divisor decreases the quotient increases. This would imply a value greater than 12 but we only have 12 items to begin with for distribution.
So does this mean we can simply express it as a Remainder value ?
This can not even be expressed in the form of a remainder. Remainder are expressed in relation to the divisor as shown in the following example:
So the revised formula is:
Dividend ÷ Divisor = Quotient + Remainder/Divisor (where Divisor <> 0 )
Division by Zero is like a “Black Hole”, it is accounted for in all calculators and will generate an error.
I will show you how to handle Division By Zero T-SQL Queries in the next blog post.