- USE SourceDatabase
- GO
- IF OBJECT_ID('SalesHistory')>0 DROP TABLE SalesHistory
- GO
- CREATE TABLE SalesHistory
- (SaleID INT IDENTITY(1,1),
- Product CHAR(150), SaleDate DATETIME,
- SalePrice MONEY)
- DECLARE @i INT
- SET @i = 1
- WHILE (@i <=10000)
- BEGIN INSERT INTO SalesHistory
- (Product, SaleDate, SalePrice)
- VALUES ('Computer', DATEADD(mm, @i, '3/11/1919'),
- DATEPART(ms, GETDATE()) + (@i + 57) )
- INSERT INTO SalesHistory
- (Product, SaleDate, SalePrice)
- VALUES ('BigScreen', DATEADD(mm, @i, '3/11/1927'),
- DATEPART(ms, GETDATE()) + (@i + 13) )
- INSERT INTO SalesHistory
- (Product, SaleDate, SalePrice)
- VALUES ('PoolTable', DATEADD(mm, @i, '3/11/1908'),
- DATEPART(ms, GETDATE()) + (@i + 29) )
- SET @i = @i + 1
- END
- GO
复制代码 |