日期:2014-05-17 浏览次数:20488 次
if OBJECT_ID('a') is not null
drop table a
go
--1.新建一个表
select * into a
from sys.objects
--2.查询表
select * from a
--3.能查询,是否缓存在内存中了
select db_name(database_id),
file_id,
page_id,
page_type,
is_modified,
o.name as table_name
from sys.dm_os_buffer_descriptors d
inner join sys.allocation_units au
on au.allocation_unit_id = d.allocation_unit_id
inner join sys.partitions p
on au.container_id = p.hobt_id
inner join sys.objects o
on p.object_id = p.object_id
where o.type_desc = 'USER_TABLE'
and o.is_ms_shipped = 0
and d.database_id = 数据库id
order by page_id