Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Drop table if exists
- IF (OBJECT_ID('dbo.Test')) IS NOT NULL DROP TABLE dbo.Test;
- --Create Table for Testing
- CREATE TABLE dbo.Test(Id INT IDENTITY(1,1) CONSTRAINT PK_Test PRIMARY KEY CLUSTERED, TextValue VARCHAR(20) NULL);
- --Insert enough data so we have more than 8Mb (the threshold at which sampling kicks in)
- INSERT INTO dbo.Test(TextValue)
- SELECT TOP 1000000 'blahblahblah'
- FROM sys.objects a, sys.objects b, sys.objects c, sys.objects d;
- --Create Index on TextValue
- CREATE INDEX IX_Test_TextValue ON dbo.Test(TextValue);
- --Update Statistics without specifying how many rows to sample
- UPDATE STATISTICS dbo.Test IX_Test_TextValue;
- --View the Statistics
- DBCC SHOW_STATISTICS('dbo.Test', IX_Test_TextValue) WITH STAT_HEADER;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement