Annotations for "Modulo (Transact-SQL)" topic.Wed, 07 Dec 2016 20:35:28 Z
http://msdn.microsoft.com/en-US/library/ms190279(v=sql.110).aspx#CommunityContent
sloughinCaution when using Moduluo on negative arguments...It is important to note that SQL differs from some other programming languages in how the modulo operation defines the sign when one of the arguments is negative. In SQL, SELECT (-4)%3 returns -1, while in PERL or Mathematica, it would return 2. One can make a case that either is correct, but it will affect how one builds an algorithm around the operation. In SQL the sign of the result is the same as that of the DIVIDEND, while in many other languages it is based on the DIVISOR. Mon, 10 Dec 2012 15:35:05 -0800