SQL Scalar Function to make comparisons easier Simon Hutchinson

​This is another SQL Scalar Function I found almost by accident. The TOTALORDER scalar function allows me to compare two numbers and returns an integer to tell me which one is greater:

Comparison
Returned

Value 1 < Value 2
-1

Value 1 = Value 2
0

Value 1 > Value 2
1

The syntax for this Scalar Function is:

TOTALORDER(Value_1, Value_2)

Read more » Read More 

Verified by MonsterInsights