[英]Creating a table with date as range partition in SQL Server 2012
I am new to SQL Server coding. 我是SQL Server编码的新手。 Please let me know how to create a table with range partition on date in SQL Server 请让我知道如何在SQL Server中创建日期范围分区的表
A similar syntax in teradata would be the following (a table is created with order date as range partition over year 2012 with each day as single partition ) 以下是teradata中类似的语法(创建的表以订单日期为2012年的范围分区,每天为单个分区)
CREATE TABLE ORDER_DATA (
ORDER_NUM INTEGER NOT NULL
,CUST_NUM INTEGER
,ORDER_DATE DATE
,ORDER_TOT DECIMAL(10,2)
)
PRIMARY INDEX(ORDER_NUM)
PARTITION BY (RANGE_N ( ORDER_DATE BETWEEN DATE ‘2012-01-01’ AND DATE 2012-12-31 EACH INTERVAL ‘1’ DAY));
Thanks in advance 提前致谢
The process of creating partitioned table is described on MSDN as follows: MSDN上描述了创建分区表的过程,如下所示:
Creating a partitioned table or index typically happens in four parts: 1. Create a filegroup or filegroups and corresponding files that will hold the partitions specified by the partition scheme. 2. Create a partition function that maps the rows of a table or index into partitions based on the values of a specified column. 3. Create a partition scheme that maps the partitions of a partitioned table or index to the new filegroups. 4. Create or modify a table or index and specify the partition scheme as the storage location.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.