sql server 表分区

添加文件分组

sql server 表分区_第1张图片
image.png

创建文件,并分配文件组

sql server 表分区_第2张图片
image.png

分区函数

   CREATE PARTITION FUNCTION partCustomerStockHistory (datetime)

  AS RANGE RIGHT FOR VALUES ('20160101','20170101','20180101','20180630','20190101','20190630','20200101')

分区方案

 CREATE PARTITION SCHEME partschCustomerStockHistory

  AS PARTITION partCustomerStockHistory

  TO ( h2016,  h2017, h201801, h201806, h201901, h201906, h202001, h202006)

建表

CREATE TABLE CustomerStockHistoryOfK(
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [CustomerLegalId] [int] NOT NULL,
    [ProductId] [int] NOT NULL,
    ON partschCustomerStockHistory([CreatedOn])

我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3fmp3lsj42qs4

你可能感兴趣的:(sql server 表分区)