CREATE TABLE data (OrderID INT IDENTITY(1,1) PRIMARY KEY, OrderDate DATETIME,
CustomerID INT, ProductCode VARCHAR(50), Amount INT)
GO
/*insert 100,000 rows of random data*/
INSERT INTO data (OrderDate, CustomerID, ProductCode, Amount)
SELECT TOP 100000 GETDATE() - ABS(CHECKSUM(NEWID())) % 730,
ABS(CHECKSUM(NEWID())) % 10000 + 1,
char(65+ ABS(CHECKSUM(NEWID())) % 26) + char(65+ ABS(CHECKSUM(NEWID())) % 26) + char(65+ ABS(CHECKSUM(NEWID())) % 26) + char(65+ ABS(CHECKSUM(NEWID())) % 26) + char(65+ ABS(CHECKSUM(NEWID())) % 26) + char(65+ ABS(CHECKSUM(NEWID())) % 26),
ABS(CHECKSUM(NEWID())) % 100
FROM master..sysobjects a cross join master..sysobjects b
No comments:
Post a Comment