码迷,mamicode.com
首页 > 数据库 > 详细

sqlserver表分区

时间:2015-08-21 19:18:07      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

 

参考:http://www.cnblogs.com/knowledgesea/p/3696912.html

及百度搜索sqlserver表分区

 

create partition 
function sgy_partitionfun (int) as range left for values(N‘10000‘, N‘20000‘)

//drop partition function sgy_partitionfun



BEGIN TRANSACTION


--创建分区方案
CREATE PARTITION SCHEME [bgPartitionSchema] AS PARTITION sgy_partitionfun TO ([PRIMARY], filegroup1, filegroup2)

--创建分区索引
CREATE CLUSTERED INDEX [ClusteredIndex_on_bgPartitionSchema_635342971076448165] ON gms_item
(
    gameserverid
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [bgPartitionSchema](gameserverid)

--删除分区索引
DROP INDEX [ClusteredIndex_on_bgPartitionSchema_635342971076448165] ON gms_item WITH ( ONLINE = OFF )

COMMIT TRANSACTION

select * from gms_item where $partition.sgy_partitionfun(gameserverid)=1

  

sqlserver表分区

标签:

原文地址:http://www.cnblogs.com/barrysgy/p/4748540.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!