7 个解决方案
#1
---查看分区表的原代码就可以了!
#2
http://blog.csdn.net/pt1314917/archive/2009/08/11/4435083.aspx
#3
-- 创建分区函数
create partition function PF_Orders_OrderDateRange(datetime)
as
range right for values (
'1997-01-01',
'1998-01-01',
'1999-01-01'
)
go
-- 创建分区方案
create partition scheme PS_Orders
as
partition PF_Orders_OrderDateRange
to ([primary], [primary], [primary], [primary])
go
-- 创建分区表
create table dbo.Orders
(
OrderID int not null
,CustomerID varchar(10) not null
,EmployeeID int not null
,OrderDate datetime not null
)
on PS_Orders(OrderDate)
go
-- 创建聚集分区索引
create clustered index IXC_Orders_OrderDate on dbo.Orders(OrderDate)
go
-- 为分区表设置主键
alter table dbo.Orders add constraint PK_Orders
primary key (OrderID, CustomerID, OrderDate)
go
-- 导入数据到分区表
insert into dbo.Orders
select OrderID, CustomerID, EmployeeID, OrderDate
from dbo.Orders_From_SQL2000_Northwind --(注:数据来源于 SQL Server 2000 示例数据库)
go
-- 查看分区表每个分区的数据分布情况
select partition = $partition.PF_Orders_OrderDateRange(OrderDate)
,rows = count(*)
,minval = min(OrderDate)
,maxval = max(OrderDate)
from dbo.Orders
group by $partition.PF_Orders_OrderDateRange(OrderDate)
order by partition
go
#4
我只想知道一个分区表所基于的分区方案,partition schema,或者是表所在的filegroup,楼上说的那些,我很早就看过了,还是要谢谢先
#5
只能自己顶一下了,有没有哪个大哥给指点一下
#6
哎这么冷清,难道就没人能告诉我答案么,欲哭无泪
#1
---查看分区表的原代码就可以了!
#2
http://blog.csdn.net/pt1314917/archive/2009/08/11/4435083.aspx
#3
-- 创建分区函数
create partition function PF_Orders_OrderDateRange(datetime)
as
range right for values (
'1997-01-01',
'1998-01-01',
'1999-01-01'
)
go
-- 创建分区方案
create partition scheme PS_Orders
as
partition PF_Orders_OrderDateRange
to ([primary], [primary], [primary], [primary])
go
-- 创建分区表
create table dbo.Orders
(
OrderID int not null
,CustomerID varchar(10) not null
,EmployeeID int not null
,OrderDate datetime not null
)
on PS_Orders(OrderDate)
go
-- 创建聚集分区索引
create clustered index IXC_Orders_OrderDate on dbo.Orders(OrderDate)
go
-- 为分区表设置主键
alter table dbo.Orders add constraint PK_Orders
primary key (OrderID, CustomerID, OrderDate)
go
-- 导入数据到分区表
insert into dbo.Orders
select OrderID, CustomerID, EmployeeID, OrderDate
from dbo.Orders_From_SQL2000_Northwind --(注:数据来源于 SQL Server 2000 示例数据库)
go
-- 查看分区表每个分区的数据分布情况
select partition = $partition.PF_Orders_OrderDateRange(OrderDate)
,rows = count(*)
,minval = min(OrderDate)
,maxval = max(OrderDate)
from dbo.Orders
group by $partition.PF_Orders_OrderDateRange(OrderDate)
order by partition
go
#4
我只想知道一个分区表所基于的分区方案,partition schema,或者是表所在的filegroup,楼上说的那些,我很早就看过了,还是要谢谢先
#5
只能自己顶一下了,有没有哪个大哥给指点一下
#6
哎这么冷清,难道就没人能告诉我答案么,欲哭无泪