美文网首页一步一坑
sql server 表分区

sql server 表分区

作者: 易兒善 | 来源:发表于2018-08-08 10:47 被阅读3次

    添加文件分组

    image.png

    创建文件,并分配文件组

    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 表分区

        本文链接:https://www.haomeiwen.com/subject/sdltbftx.html