why doesn't it meet the requirements / question?
He wants to have the content of the index itself or do I missunderstand the request?
CREATE TABLE dbo.foo
id INT NOT NULL,
c1 CHAR(20) NOT NULL,
c2 DATE NOT NULL,
CONSTRAINT pk_foo_id PRIMARY KEY CLUSTERED (Id)
INSERT INTO dbo.foo (id, c1, c2) VALUES
(1, 'col1', '20140101'),
(2, 'col2', '20140201'),
(3, 'col3', '20140301'),
(4, 'col4', '20140401')
CREATE NONCLUSTERED INDEX ix_foo_c2 ON dbo.foo(c2);
-- check the index id's of dbo.foo
SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.foo');
-- IF nonclustered index is ID = 2
DBCC IND('demo', 'dbo.foo', 2);
-- Output of page content to client
-- after execution of DBCC IND the page with type = 2 is
-- the index page! 10 is IAM!
-- Replace the page_id with that evaluated id
DBCC TRACEON (3604);
DBCC PAGE('demo', 1, <page_id, 3);
When running this script you get the list of values from one page of the index with its content!
BTW: The question was from 2012
Seems to be worthless to discuss the intention
Microsoft Certified Master: SQL Server 2008
MVP - Data Platform (2013 - ...)
my blog: http://www.sqlmaster.de