Reputation: 41
I inherited some SQL codes and one part of the codes goes like:
CASE WHEN
(CAST(CAST(b.xx AS numeric(11, 6))
* CAST(a.ratio AS numeric(11, 6)) AS decimal(10, 0)) % a.mktcoupons =0)
THEN CAST((CAST(b.xx AS numeric(11, 6)) *
CAST(a.ratio AS numeric(11, 6))) / a.mktcoupons AS decimal(10, 0))
ELSE
CAST(( CAST(b.xx AS numeric(11, 6))
* CAST(a.ratio AS numeric(11, 6))) / a.mktcoupons AS decimal(10, 0))
+ (CAST(CAST(b.xx AS numeric(11, 6))
* CAST(a.ratio AS numeric(11, 6)) AS decimal(10, 0)) % a.mktcoupons)
END AS yy
I understand the general expression of 'case when A then B else C end' . However, I am having a hard time figuring out what does '%' mean? I checked 'mktcoupons' and there is no zero value in 'mktcoupon'. Any idea? Thanks!
Upvotes: 0
Views: 431
Reputation: 1652
If its in a mathematical operation its most likely modulo.
If its used in a string it basically means "any number of any character".
Upvotes: 0
Reputation: 1455
it is a modulo division. see here: https://msdn.microsoft.com/de-de/library/ms190279.aspx
Upvotes: 4