SQLServer 表分区
时间:2010-12-31 来源:sweting
最后,我们可以填充数据了
USE [Data Partition DB2] go declare @count int set @count =-25 while @count <=100 begin insert into MyTable select @count,getdate(),100.00 set @count=@count+1 end set @count =101 while @count <=200 begin insert into MyTable select @count,getdate(),200.00 set @count=@count+1 end set @count =201 while @count <=300 begin insert into MyTable select @count,getdate(),300.00 set @count=@count+1 end set @count =301 while @count <=400 begin insert into MyTable select @count,getdate(),400.00 set @count=@count+1 end set @count =401 while @count <=800 begin insert into MyTable select @count,getdate(),500.00 set @count=@count+1 end
最后,我们可以查询下,插入的这些数据,是否真的被划分到四个不同的文件组里的表分区了,可以这样看
SELECT *, $PARTITION.[Data Partition Range](ID)
FROM MyTable
相关阅读 更多 +