如何用SQL语句获取创建分区函数和分区架构的语句

oopp1234567890 2011-02-27 11:06:20

目前只能查到分区的 一个范围,拼接才能得到想要的语句,有没有办法直接获取?

THS
...全文
97 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
中国风 2011-03-03
?這樣效果
分区表的相关信息
SELECT
SchemaName = S.name,
TableName = TB.name,
PartitionScheme = PS.name,
PartitionFunction = PF.name,
PartitionFunctionRangeType = CASE
WHEN boundary_value_on_right = 0 THEN 'LEFT'
ELSE 'RIGHT' END,
PartitionFunctionFanout = PF.fanout,
SchemaID = S.schema_id,
ObjectID = TB.object_id,
PartitionSchemeID = PS.data_space_id,
PartitionFunctionID = PS.function_id
FROM sys.schemas S
INNER JOIN sys.tables TB
ON S.schema_id = TB.schema_id
INNER JOIN sys.indexes IDX
on TB.object_id = IDX.object_id
AND IDX.index_id < 2
INNER JOIN sys.partition_schemes PS
ON PS.data_space_id = IDX.data_space_id
INNER JOIN sys.partition_functions PF
ON PS.function_id = PF.function_id
回复
oopp1234567890 2011-02-28
回复
快溜 2011-02-27
oopp1234567890 2011-02-27
大班,你这个不是我想要的效果啊。我是想得到创建分区的函数和架构

你这个只是这样:
partition_id object_id index_id partition_number hobt_id rows
-------------------- ----------- ----------- ---------------- -------------------- --------------------
72057626727743488 554042051 4 1 72057626727743488 0
72057626727809024 554042051 1 1 72057626727809024 0
72057626727874560 554042051 5 1 72057626727874560 0
72057626727940096 554042051 3 1 72057626727940096 0
72057626728005632 554042051 2 1 72057626728005632 0

(5 行受影响)
回复
中国风 2011-02-27
查看分区的数据分布
SLECT * FROM SYS.PARTITIONS WHERE OBJECT_ID = OBJECT_ID ( '分区表' )
回复
相关推荐
发帖
疑难问题
创建于2007-09-28

2.1w+

社区成员

MS-SQL Server 疑难问题
申请成为版主
帖子事件
创建了帖子
2011-02-27 11:06
社区公告
暂无公告