DIVIDE function in T-SQL
The languages MDX and DAX both have a DIVIDE function, which has the following syntax:
DIVIDE(<numerator>, <denominator> [,<alternateresult>])
The alternate result is specified as the result when a division by zero is encountered. If it isn't specified, NULL is returned.
This would be a fine addition to the T-SQL language.
Alan Singfield commented
To just avoid divide by zero:
result = numerator / NULLIF(denominator, 0)
Or to put an alternate result:
result = ISNULL(numerator / NULLIF(denominator, 0), 12345)