-
-
Save wBobuk/3dfb73cd497448cb73d00ca6a9126864 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF EXISTS ( SELECT * FROM sys.tables WHERE object_id = OBJECT_ID('dbo.numbers') ) | |
DROP TABLE dbo.numbers | |
GO | |
CREATE TABLE dbo.numbers | |
( | |
number INT NOT NULL | |
) | |
WITH | |
( | |
DISTRIBUTION = REPLICATE, | |
CLUSTERED INDEX ( number ) | |
) | |
GO | |
--TRUNCATE TABLE dbo.numbers | |
-- Generate some test data | |
INSERT INTO dbo.numbers ( number ) | |
VALUES ( 1 ) | |
GO | |
INSERT INTO dbo.numbers ( number ) | |
SELECT MAX(number) OVER() + ROW_NUMBER() OVER( ORDER BY number ) | |
FROM dbo.numbers | |
GO 20 | |
-- Make sure there are exaclty 1 million rows | |
DELETE dbo.numbers WHERE number > 1000000 | |
GO | |
-- Tests | |
select count(*) from dbo.numbers | |
select top 100 * from dbo.numbers order by number | |
select top 100 * from dbo.numbers order by number desc | |
GO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!