How Can We Help?
Answer
To generate random data:
Sample One
SELECT 'IT', ABS(CONVERT(BIGINT,CONVERT(BINARY(8), NEWID()))) % 50 AS Random UNION ALL SELECT 'HCP', ABS(CONVERT(BIGINT,CONVERT(BINARY(8), NEWID()))) % 50 AS Random UNION ALL SELECT 'Stationary', ABS(CONVERT(BIGINT,CONVERT(BINARY(8), NEWID()))) % 24 AS Random
Replacing the IT, HCP and Stationary as required, the random seed of 50, 50 and 24 should also be amended as required.
Resulting data of the above.
Sample Two
SELECT [Date] = DATEADD(Day,-Number,GetDate()), ABS(CONVERT(BIGINT,CONVERT(BINARY(8), NEWID()))) % 10000 AS Random FROM master..spt_values WHERE Type='P' AND DATEADD(day,-Number,GetDate()) >= DATEADD(DAY, -30, GETDATE())
Replacing the 10000 as the seed value required.
Resulting data of the above.
Comments are closed.