Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

How to view index content?

I have created PK_Student_StudId (clustered).

I suppose I could view the content of index table (index data) using

Select StudID, StudName, Class From Student Order By StudID;


But, is there a way I can access and view the actual table my PK_Student_StudId index has created?

Or, is it in binary form and cannot be viewed directly? If so, how can be transformed and viewed?

At least its number of rows and its column names to be printed/ investigated.

Thank you.
Avatar of edtechdba
edtechdba
Flag of United States of America image

Viewing Index Information
http://technet.microsoft.com/en-us/library/ms188280(v=sql.105).aspx

Running an sp_helpindex may also give you the index info that you need.
EXEC sp_helpindex 'Student.StudID'
Another option for viewing index information for your table.
http://technet.microsoft.com/en-us/library/ms189603(v=sql.105).aspx
Avatar of Mike Eghtebas

ASKER

I tried:

EXEC sp_helpindex 'Student.StudID'
Error: Msg 15009, Level 16, State 1, Procedure sp_helpindex, Line 37
The object 'Student.StudID' does not exist in database 'DBstudy' or is invalid for this operation.

EXEC sp_helpindex 'PK_Student_StudId'
The object 'PK_Student_StudId' does not have any indexes, or you do not have permissions.

EXEC sp_helpindex 'Student'
Error: Msg 15009, Level 16, State 1, Procedure sp_helpindex, Line 37
The object 'StudId' does not exist in database 'DBstudy' or is invalid for this operation.

I will read the links next.

Thank you for the comments.

Mike
1. From link, http://technet.microsoft.com/en-us/library/ms188280(v=sql.105).aspx , for example, I do I use:
                                          sys.stats_columns

from c prompt ot T-sql? What is the syntax?
ASKER CERTIFIED SOLUTION
Avatar of edtechdba
edtechdba
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I also noticed the following works without ' either side:

EXEC sp_helpindex Student