在SQL SERVER取亂數的方式:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.zh-CHT/tsqlref9/html/363c84d6-b9fa-49ba-9a75-e44f27535ff6.htm

範例: 

DECLARE @counter smallint
SET @counter = 1
WHILE @counter < 5
BEGIN
SELECT RAND() Random_Number
SET @counter = @counter + 1
END
GO