1> create table t(a int identity, b char(5) default 'x')
2> go
1> insert into t default values
2> go 5
1> select sys.fn_PhysLocFormatter(%%physloc%%) as RID, * from t
2> go
RID a b
---------- ----------- -----
(1:21:0) 1 x
(1:21:1) 2 x
(1:21:2) 3 x
(1:21:3) 4 x
(1:21:4) 5 x
与Oracle的DBMS_ROWID包中的函数功能相同,但是这个更好用。
另外一个函数是sys.fn_physLocCracker ,其用法如下:
1> create table t(a int)
2> insert into t values(1)
3> insert into t values(2)
4> insert into t values(3)
5> insert into t values(4)
6> go
1> select * from t Cross Apply sys.fn_physLocCracker (%%physloc%%) AS plc;
2> go
a file_id page_id slot_id
----------- ----------- ----------- -----------
1 1 278 0
2 1 278 1
3 1 278 2
4 1 278 3
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/37724/viewspace-1022632/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/37724/viewspace-1022632/