加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQL Server根据分区表名查找所在的文件及文件组实现脚本

发布时间:2020-12-12 09:20:09 所属栏目:MsSql教程 来源:网络整理
导读:div class="jb51code" pre class="brush:sql;" SELECT ps.name AS PSName,dds.destination_idAS PartitionNumber,fg.name AS FileGroupName,fg.name,t.name,f.name as filename FROM (((sys.tables AS t INNER JOIN sys.indexes AS i ON (t.object_id = i.ob

<div class="jb51code">
<pre class="brush:sql;">
SELECT ps.name AS PSName,dds.destination_idAS PartitionNumber,fg.name AS FileGroupName,fg.name,t.name,f.name as filename
FROM (((sys.tables AS t
INNER JOIN sys.indexes AS i
ON (t.object_id = i.object_id))
INNER JOIN sys.partition_schemes AS ps
ON (i.data_space_id = ps.data_space_id))
INNER JOIN sys.destination_data_spacesAS dds
ON (ps.data_space_id = dds.partition_scheme_id))
INNER JOIN sys.filegroups AS fg
ONdds.data_space_id =fg.data_space_id
innerjoin sys.database_files f on f.data_space_id = fg.data_space_id
where t.name='salesOrder'

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读