sql generate random number code example Example 1: sql random integer SELECT RAND(); Example 2: tsql random number SELECT FLOOR(RAND()*(b-a+1))+a;