1、如何查看某张表的索引?
2、如何查看整个库的索引?
3 个解决方案
#1
USE test
GO
-- 查看某個表的索引
SELECT * FROM sys.sysindexes
WHERE id=object_id('RelactionGraph')
-- 查看整個庫的索引
SELECT * FROM sys.sysindexes
-- 查看所有庫的索引
IF object_id('tempdb..#')IS NOT NULL
DROP TABLE #
SELECT * INTO # FROM sys.sysindexes WHERE 1=2
INSERT INTO #
EXEC sys.sp_MSforeachdb @command1='Select * from ?.sys.sysindexes'
SELECT * FROM #
#2
good thing
#3
我查找到了一个更好的方法:
EXEC sp_helpindex 'person.person'
EXEC sp_helpindex 'person.person'
#1
USE test
GO
-- 查看某個表的索引
SELECT * FROM sys.sysindexes
WHERE id=object_id('RelactionGraph')
-- 查看整個庫的索引
SELECT * FROM sys.sysindexes
-- 查看所有庫的索引
IF object_id('tempdb..#')IS NOT NULL
DROP TABLE #
SELECT * INTO # FROM sys.sysindexes WHERE 1=2
INSERT INTO #
EXEC sys.sp_MSforeachdb @command1='Select * from ?.sys.sysindexes'
SELECT * FROM #
#2
good thing
#3
我查找到了一个更好的方法:
EXEC sp_helpindex 'person.person'
EXEC sp_helpindex 'person.person'