SQL Server

Generate SQL Server Test Data

I came across (thanks Paul) a great way to quickly generate test data for SQL Server today. DECLARE @rows INT, @a int SET @rows = 50 SELECT * INTO dbo.RobTest FROM (SELECT TOP (@rows) Rownumber = ROW_NUMBER() OVER (ORDER BY (SELECT 1)), SomeInt = ABS(CHECKSUM(NEWID())) % 50000 + 1 , SomeLetters2 = CHAR(ABS(CHECKSUM(NEWID())) % 26 + 65) + CHAR(ABS(CHECKSUM(NEWID())) % 26 + 65) , SomeMoney = CAST(ABS(CHECKSUM(NEWID())) % 10000 / 100.0 AS MONEY) , SomeDate = CAST(RAND(CHECKSUM(NEWID())) * 3653.0 + 36524.0 ......