SQL Server 查看一个表上的索引
方法:1
sys.indexes
index_id =0:堆
index_id =1:聚集索引
index_id =2.....:非聚集索引
-------------------------------------------------------------------------------------
例子:
create table Student(
ID int not null,
Name nvarchar(16),
Major nvarchar(16));
go
create index ix_for_Student_ID
on dbo.student(ID);
go
create clustered index ix_clu_for_Student_Name
on dbo.Student(Name);
go
select OBJECT_NAME(ix.object_id),ix.index_id,ix.name from sys.indexes as ix
where ix.object_id = object_id(‘Student‘);
go
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。