Database Reference
In-Depth Information
create partition scheme psOrders2012
as partition pfOrders2012
all to ([FG2012]);
create table dbo.Orders2012
(
OrderId int not null,
OrderDate datetime2(0) not null,
OrderNum varchar(32) not null,
OrderTotal money not null,
CustomerId int not null,
/* Other Columns */
constraint CHK_Orders2012
check(OrderDate >= '2012-01-01' and OrderDate < '2013-01-01')
);
create unique clustered index IDX_Orders2012_OrderDate_OrderId
on dbo.Orders2012(OrderDate, OrderId)
with (data_compression = page)
on psOrders2012(OrderDate);
create nonclustered index IDX_Orders2012_CustomerId
on dbo.Orders2012(CustomerId)
with (data_compression = page)
on psOrders2012(OrderDate);
go
/* dbo.Orders2013 table definition */
create partition function pfOrders2014(datetime2(0))
as range right for values
('2014-02-01', '2014-03-01','2014-04-01','2014-05-01','2014-06-01'
,'2014-07-01','2014-08-01','2014-09-01','2014-10-01','2014-11-01'
,'2014-12-01');
create partition scheme psOrders2014
as partition pfOrders2014
all to ([FG2014]);
create table dbo.Orders2014
(
OrderId int not null,
OrderDate datetime2(0) not null,
OrderNum varchar(32) not null,
OrderTotal money not null,
CustomerId int not null,
/* Other Columns */
constraint CHK_Orders2014
check(OrderDate >= '2014-01-01' and OrderDate < '2014-05-01')
);
Search WWH ::




Custom Search