I'm using this script to generate some data
select case abs(checksum(newid())) % 5 + 1
when 1 then 'excellent'
when 2 then 'good'
when 3 then 'fair'
when 4 then 'poor'
when 5 then 'failing'
end
It returns these values: excellent,good,fair,poor,failing,null
I assumed I was getting a result outside of 1,2,3,4,5
causing the null
to return from the case. So I executed this script:
select abs(checksum(newid())) % 5 + 1
It returns only these values: 1,2,3,4,5
Assuming I didn't get a 0 or 6 during debugging due to some exceptional statistical phenomenon (because I ran the statement > 100 times), there is some other issue causing this.