Dear all,

Let get into business, the partitions on sql server is very different with that on oracle.

I do not want to speak too much, Here is an example.

At beginning, we should create a partition function

CREATE PARTITION FUNCTION [PF_DATETIME_M_TEST](datetime) AS RANGE RIGHT FOR VALUES (N'2013-08-01T00:00:00.000',N'2013-09-01T00:00:00.000', N'2013-10-01T00:00:00.000', N'2013-11-01T00:00:00.000', N'2013-12-01T00:00:00.000', N'2014-01-01T00:00:00.000', N'2014-02-01T00:00:00.000', N'2014-03-01T00:00:00.000', N'2014-04-01T00:00:00.000', N'2014-05-01T00:00:00.000', N'2014-06-01T00:00:00.000', N'2014-07-01T00:00:00.000', N'2014-08-01T00:00:00.000', N'2014-09-01T00:00:00.000', N'2014-10-01T00:00:00.000', N'2014-11-01T00:00:00.000', N'2014-12-01T00:00:00.000', N'2015-01-01T00:00:00.000', N'2015-02-01T00:00:00.000', N'2015-03-01T00:00:00.000', N'2015-04-01T00:00:00.000', N'2015-05-01T00:00:00.000', N'2015-06-01T00:00:00.000', N'2015-07-01T00:00:00.000', N'2015-08-01T00:00:00.000', N'2015-09-01T00:00:00.000', N'2015-10-01T00:00:00.000', N'2015-11-01T00:00:00.000', N'2015-12-01T00:00:00.000', N'2016-01-01T00:00:00.000')

You seem, the partittion function is used to define partition key range,

Next we need to create partittion schema

CREATE PARTITION SCHEME [PS_DATETIME_M_TEST] AS PARTITION [PF_DATETIME_M_TEST] TO ([XXXXFG_initial],[XXXXFG_201308], [XXXXFG_201309], [XXXXFG_201310], [XXXXFG_201311], [XXXXFG_201312], [XXXXFG_201401], [XXXXFG_201402], [XXXXFG_201403], [XXXXFG_201404], [XXXXFG_201405], [XXXXFG_201406], [XXXXFG_201407], [XXXXFG_201408], [XXXXFG_201409], [XXXXFG_201410], [XXXXFG_201411], [XXXXFG_201412], [XXXXFG_201501], [XXXXFG_201502], [XXXXFG_201503], [XXXXFG_201504], [XXXXFG_201505], [XXXXFG_201506], [XXXXFG_201507], [XXXXFG_201508], [XXXXFG_201509], [XXXXFG_201510], [XXXXFG_201511], [XXXXFG_201512], [XXXXFG_201601])
GO

the partititon schema is to tell database which rang locate on which place --- filegroup.

Then we can go for generating partititon now.

CREATE TABLE [dbo].[LAS_DATA_TEST](
[IDN] [numeric](19, 0) NOT NULL,
[RECORD_NO] [numeric](20, 0) NOT NULL,
[CREATE_DATE] [datetime] NOT NULL,
[RECORD_TYPE] [numeric](9, 0) NULL,
[FAULT_YPOS] [numeric](9, 2) NULL,
[FILE_NAME] [nvarchar](100) NULL,
[FILE_DIRECTORY] [nvarchar](50) NULL,
[FAULT_MARK] [nvarchar](50) NULL,
[CAMERA_NO] [nvarchar](4) NULL,
[FAULT_START_ZONE] [numeric](9, 2) NULL,
[FAULT_END_ZONE] [numeric](9, 2) NULL,
[FAULT_GROUP_NO] [numeric](9, 2) NULL,
[FAULT_RANK_NO] [numeric](9, 2) NULL,
[PERIOD_TERM] [numeric](9, 2) NULL,
[PERIOD_NO] [numeric](9, 2) NULL,
[FAULT_XPOS] [numeric](9, 2) NULL,
[FAULT_WIDTH] [numeric](9, 2) NULL,
[LINE_SPEED] [numeric](9, 2) NULL,
[AL_BOXW] [numeric](9, 2) NULL,
[AD_BOXW] [numeric](9, 2) NULL,
[BL_BOXW] [numeric](9, 2) NULL,
[BD_BOXW] [numeric](9, 2) NULL,
[CL_BOXW] [numeric](9, 2) NULL,
[CD_BOXW] [numeric](9, 2) NULL,
[DT_BOXW] [numeric](9, 2) NULL,
[ST_BOXW] [numeric](9, 2) NULL,
[DM_BOXW] [numeric](9, 2) NULL,
[AL_BOXL] [numeric](9, 2) NULL,
[AD_BOXL] [numeric](9, 2) NULL,
[BL_BOXL] [numeric](9, 2) NULL,
[BD_BOXL] [numeric](9, 2) NULL,
[CL_BOXL] [numeric](9, 2) NULL,
[CD_BOXL] [numeric](9, 2) NULL,
[DT_BOXL] [numeric](9, 2) NULL,
[ST_BOXL] [numeric](9, 2) NULL,
[DM_BOXL] [numeric](9, 2) NULL,
[AL_PEAK] [numeric](9, 2) NULL,
[AD_PEAK] [numeric](9, 2) NULL,
[BL_PEAK] [numeric](9, 2) NULL,
[BD_PEAK] [numeric](9, 2) NULL,
[CL_PEAK] [numeric](9, 2) NULL,
[CD_PEAK] [numeric](9, 2) NULL,
[DT_PEAK] [numeric](9, 2) NULL,
[ST_PEAK] [numeric](9, 2) NULL,
[DM_PEAK] [numeric](9, 2) NULL,
[AL_AREA] [numeric](9, 2) NULL,
[AD_AREA] [numeric](9, 2) NULL,
[BL_AREA] [numeric](9, 2) NULL,
[BD_AREA] [numeric](9, 2) NULL,
[CL_AREA] [numeric](9, 2) NULL,
[CD_AREA] [numeric](9, 2) NULL,
[DT_AREA] [numeric](9, 2) NULL,
[ST_AREA] [numeric](9, 2) NULL,
[DM_AREA] [numeric](9, 2) NULL,
[AL_RATE1] [numeric](9, 2) NULL,
[AD_RATE1] [numeric](9, 2) NULL,
[BL_RATE1] [numeric](9, 2) NULL,
[BD_RATE1] [numeric](9, 2) NULL,
[CL_RATE1] [numeric](9, 2) NULL,
[CD_RATE1] [numeric](9, 2) NULL,
[DT_RATE1] [numeric](9, 2) NULL,
[ST_RATE1] [numeric](9, 2) NULL,
[DM_RATE1] [numeric](9, 2) NULL,
[AL_RATE2] [numeric](9, 2) NULL,
[AD_RATE2] [numeric](9, 2) NULL,
[BL_RATE2] [numeric](9, 2) NULL,
[BD_RATE2] [numeric](9, 2) NULL,
[CL_RATE2] [numeric](9, 2) NULL,
[CD_RATE2] [numeric](9, 2) NULL,
[DT_RATE2] [numeric](9, 2) NULL,
[ST_RATE2] [numeric](9, 2) NULL,
[DM_RATE2] [numeric](9, 2) NULL,
[AL_RATE3] [numeric](9, 2) NULL,
[AD_RATE3] [numeric](9, 2) NULL,
[BL_RATE3] [numeric](9, 2) NULL,
[BD_RATE3] [numeric](9, 2) NULL,
[CL_RATE3] [numeric](9, 2) NULL,
[CD_RATE3] [numeric](9, 2) NULL,
[DT_RATE3] [numeric](9, 2) NULL,
[ST_RATE3] [numeric](9, 2) NULL,
[DM_RATE3] [numeric](9, 2) NULL,
[RESERVE3] [numeric](9, 2) NULL,
[RESERVE4] [numeric](9, 2) NULL,
[REMARK] [nvarchar](1000) NULL,
[INDEX_NO] [numeric](5, 0) NULL,
[DEFECT_TYPE] [nvarchar](50) NULL,
[MAX_SIZE] [numeric](9, 2) NULL,
[MIN_SIZE] [numeric](9, 2) NULL,
[F_R] [numeric](9, 2) NULL,
[UPDATE_DATE] [datetime] NULL,
[PVA_WIDTH_MAX] [numeric](9, 1) NULL,
[PVA_WIDTH_MIN] [numeric](9, 1) NULL,
[PEAK_AREA] [numeric](9, 3) NULL,
[GRADE] [nvarchar](100) NULL,
[FAULT_DETECT_SIZE] [numeric](9, 0) NULL,
[STRONG_SPOT_SIZE] [numeric](9, 0) NULL,
[STRONG_SPOT_FR] [numeric](19, 0) NULL,
[FAULT_EXCEPT_MAX] [numeric](9, 0) NULL,
[FAULT_EXCEPT_MIN] [numeric](9, 0) NULL,
[FAULT_EXCEPT_FR_MAX] [numeric](9, 0) NULL,
[FAULT_EXCEPT_FR_MIN] [numeric](9, 0) NULL,
[FAULT_DETECT_FR] [numeric](9, 0) NULL,
[IMG_FLAG] [nvarchar](1) NULL,
[IMG_SIZE_X] [numeric](9, 2) NULL,
[IMG_SIZE_Y] [numeric](9, 2) NULL,
[SERIES] [nvarchar](4) NULL,
[V_VALUE_TYPE] [nvarchar](32) NULL,
[V_VLAUE] [numeric](9, 2) NULL,
[IMG_DATA] [varbinary](max) NULL,
CONSTRAINT [LAS_DATA_TEST_PK] PRIMARY KEY CLUSTERED
(
[IDN] ASC,
[RECORD_NO] ASC,
[CREATE_DATE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON,DATA_COMPRESSION=PAGE)
)ON PS_DATETIME_M_TEST (CREATE_DATE); --- the table is normal table if there is PRIMARY, PS_DATETIME_M_TEST is partition schema and CREATE_DATE is partition key
GO

learn about sqlserver partitition and partition table 1的更多相关文章

  1. learn about sqlserver partitition and partition table --- add or remove table partitions addition more

    Yes . In the previous. chapter , we see how to generate "partition function" "parttit ...

  2. learn about sqlserver partitition and partition table --- add or remove table partitions

    demo/* add partitions */ alter database xxx add filegroup FG_=fff_201708;alter database xxx add file ...

  3. sqlserver partitition and partition table --- partition show

    I can not believe that I had done this about two years Now we know there is totally different betwee ...

  4. Mycat+Mysql 插入数据报错 i[Err] 1064 - partition table, insert must provide ColumnList

    使用Navicat连接Mycat 8066 成功插入了分库表和全局表 1.全局表 sql如下: '); '); '); 插入成功! 2.分库表 sql如下: ', null, null, null, ...

  5. sqlserver不能直接create table as select

    sqlserver不能直接create table as select 在sqlserver 下想复制一张表的,想到oracle下直接create table xxx as select * from ...

  6. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

    在 mkfs.ext4 /dev/sda2 格式化硬盘空间时,可能出现这种错误. had this situation at office where I was told to re-partiti ...

  7. WARNING: Re-reading the partition table failed with error 22: Invalid argument

    在划分磁盘分区时,遇到错误"WARNING: Re-reading the partition table failed with error 22: Invalid argument&qu ...

  8. oracle partition table 分区表详解

    Oracle partition table 分区表详解 分区表就是通过使用分区技术,将一张大表,拆分成多个表分区(独立的segment),从而提升数据访问的性能,以及日常的可维护性.分区表中,每个分 ...

  9. 计算机启动出现 Invalid Partition Table

    计算机启动出现 Invalid Partition Table 解决办法 使用大白菜启动盘进入临时系统,打开程序DiskGenius 如果系统盘(一般为 C 盘)非活动状态,先激活 如果装系统的硬盘不 ...

随机推荐

  1. html1,初识html

    vs code编辑器 安装插件 chinese 中文支持 open in browser 快速预览文件 view in browser 快捷键 快捷键 描述 shift + end 选中从光标到行尾 ...

  2. java线程相关基本方法

    java线程中常用的基本方法有wait,notify,notifyAll,sleep,join,yield等. 线程的生命周期一共分为五个部分,分别是:新建(New).就绪(Runnable).运行( ...

  3. C# 数独求解算法。

    前言 数独是一种有趣的智力游戏,但是部分高难度数独在求解过程中经常出现大量单元格有多个候选数字可以填入,不得不尝试填写某个数字然后继续推导的方法.不幸的是这种方法经常出现填到一半才发现有单元格无数可填 ...

  4. Spring Boot2 系列教程 (五) | yaml 配置文件详解

    自定义属性加载 首先构建 SpringBoot 项目,不会的看这篇旧文 使用 IDEA 构建 Spring Boot 工程. 首先在项目根目录 src >> resource >&g ...

  5. 最短路Dijkstra算法模板

    // // dijkstra妯℃澘.cpp // algorithm // // Created by david.xu on 2018/8/6. // Copyright 漏 2018骞?david ...

  6. python的requests用法详解

    Requests是一个Python语言写的http相关设置或者请求的一个库 安装:pip install Requests或者pip3 install requests 使用的时候要import re ...

  7. 关于neo4j初入门(2)

    DELETE删除 删除节点及相关节点和关系. DELETE <node-name-list> DELETE <node1-name>,<node2-name>,&l ...

  8. LeetCode 第15题-三数之和

    1. 题目 2.题目分析与思路 3.思路 1. 题目 给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且 ...

  9. mysql 用户操作和授权

    1.查看mysql的版本 mysql -V 2.用户操作 # 创建用户 create user 'username'@'ip地址' identified by '密码'; # 用户重命名 rename ...

  10. 异数OS TCP协议栈测试(三)--长连接篇

    异数OS TCP协议栈测试(三)--长连接篇 本文来自异数OS社区 github:   异数OS-织梦师(消息中间件)群: 476260389 异数OS TCP长连接技术简介 说起长连接,则首先要谈对 ...