ChrisM@Work (10/21/2014)
Wouldn't it be easier and more natural to refactor this as a function?
I agree but to return a random number, you'd probably want to use a GUID as the random seed. I'm pretty sure than NEWID() still isn't allowed in a function in 2012 but you could always use the "VIEW" trick to get a GUID.
--Jeff Moden
Change is inevitable... Change for the better is not.