Thursday, April 14, 2022

SQL random number

SELECT CAST(RAND(CHECKSUM(NEWID()))*10000 as int)

Generate a random number from 1 to 10000, can be use with any table to product random number per row