Friday, September 20, 2013

How to find out a table primary key or other key is cluster or nonclustered index

Problem:

Sometimes we need to know key of a table is cluster or noncluster.

Syntax:
-- Check IndexesSELECT OBJECT_NAME(OBJECT_ID) TableObject,[name] IndexName,[Type_Desc]FROM sys.indexesWHERE OBJECT_NAME(OBJECT_ID) =
'YourTableName' 
 

Implemenatation:

 
Suppose you table name is StudentInfo
-- Check IndexesSELECT OBJECT_NAME(OBJECT_ID) TableObject,[name] IndexName,[Type_Desc]FROM sys.indexesWHERE OBJECT_NAME(OBJECT_ID) =
'StudentInfo
 
 


No comments:

Post a Comment