I\'m using SQL Server 2012.
If I do the following to get a list of random-ish numbers in the range [1,3], it works just fine:
SELECT TOP 100
ABS
I cant tell you why, it is indeed strange, but I can give you a workaround. Select the random values into a cte before trying to use them
;with rndsrc(value_of_rand) as
(
SELECT TOP 100
ABS(CHECKSUM(NEWID()))%3 + 1
FROM sys.objects
)
SELECT TOP 100
CASE value_of_rand
WHEN 1
THEN 'one'
WHEN 2
THEN 'two'
WHEN 3
THEN 'three'
ELSE
'that is strange'
END [value_of_case]
from rndsrc
No more "that is strange"