View Code
-- 返回所有数据库的ID信息
sp_helpdb
-- 返回当前数据库的ID
select DB_ID()
-- 返回指定名称数据库的ID
select DB_ID('AdventureWorks')--6
-- file_id的获得
sp_helpfile
-- 返回指定名称表的ID
select file_id('AdventureWorks_Data') --1
DBCC IND(
['database name'|database id], -- the database to use
table name, -- the table name to list results
index id, -- an index_id from sys.indexes; -1 shows all indexes and IAMs, -2 just show IAMs
)
dbcc ind('adventureworks','HumanResources.Department',-1)
结果如下:
--PageType表示页的类型,1是数据页,2是索引页,10是保存页本身的IAM页
--列PageFID和PagePID分别代表页所在的文件数目和数据在文件内的页数目