學習SQL數據庫的表分區 不錯的文章php
http://www.cnblogs.com/beachant/archive/2011/06/24/2089046.html
SQL數據庫的表分區
html
文章裏面的SQL語句有些問題,修改後的以下:sql
--建立分區函數 create partition function PartFuncForExample(Datetime) as Range Right for Values('20000101','20010101','20020101','20030101') exec dbo.sp_show_partition_range @partition_function = 'PartFuncForExample' sp_show_partition_range 存儲過程這裏能夠找到: http://www.sqlstudy.com/sql_article.php?id=2008070801 --建立分區方案 Create Partition Scheme PartSchForExample As Partition PartFuncForExample to([PRIMARY],Partition1,Partition2,Partition3,Partition4 ) --建立表 Create Table PartitionTable( [ID] [int] Identity(1,1) not null, [Name] [nvarchar](50) not null, [LoginDate] [DateTime] not null ) On PartSchForExample([LoginDate]) select * from PartitionTable insert into PartitionTable values('test1','2002-01-04') --建立分區索引 create clustered index IXC_PartitionTable_LoginDate on dbo.PartitionTable(LoginDate) on PartSchForExample(LoginDate)