SQLServer 2005 分区表问题,高手帮忙解惑,等待中。。。。。。。。
USE TEST
--创建文件组
ALTER DATABASE TEST ADD FILEGROUP FG_01
ALTER DATABASE TEST ADD FILEGROUP FG_02
ALTER DATABASE TEST ADD FILEGROUP FG_03
--创建数据文件
ALTER DATABASE TEST ADD FILE (NAME = DF_01,
FILENAME = 'D:\TEST\DF_01.ndf ',
SIZE = 10MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10MB)
TO FILEGROUP FG_01
ALTER DATABASE TEST ADD FILE (NAME = DF_02,
FILENAME = 'D:\TEST\DF_02.ndf ',
SIZE = 10MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10MB)
TO FILEGROUP FG_02
ALTER DATABASE TEST ADD FILE (NAME = DF_03,
FILENAME = 'D:\TEST\DF_03.ndf ',
SIZE = 10MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10MB)
TO FILEGROUP FG_03
--创建分区函数
CREATE PARTITION FUNCTION PF_HIS_HTTP_LOG(datetime)
AS
RANGE LEFT FOR VALUES (
'20070101 23:59:59.997 ',
'20070102 23:59:59.997 ')
--创建分区方案
CREATE PARTITION SCHEME PS_HIS_HTTP_LOG
AS
PARTITION PF_HIS_HTTP_LOG TO
( FG_01, FG_02, [PRIMARY])
--创建分区表
CREATE TABLE HIS_HTTP_LOG
(
USERID varchar(32) , --用户名
USERIP varchar(15) , --用户IP
USERPORT numeric(5,0) , --用户端口
OBJECTIP varchar(15) , --目的IP
OBJECTPORT numeric(5,0) , --目的端口
URL varchar(256) , --URL
HOST varchar(64) , --HOST
DN varchar(64) , --域名
VISITIME numeric(5,0) , --访问次数
STARTIME datetime , --访问起始时间
ENDTIME datetime --访问结束时间
) ON PS_HIS_HTTP_LOG(STARTIME)
--插入数据,分区1 20070101
DECLARE @i int
SET @i = 1
WHILE @i <= 100
BEGIN
INSERT INTO HIS_HTTP_LOG VALUES(CAST(@i AS varchar(32)), '192.168.1.1 ',5, '202.103.1.57 ',
6, 'http://sina.com.cn ', ' ', 'www.sohu.com ',11,CONVERT(datetime, '20070101 13:25:26.100 ',121),GETDATE())
SET @i = @i +1
END
--插入数据,分区2 20070102
SET @i = 1
WHILE @i <= 200
BEGIN
INSERT INTO HIS_HTTP_LOG VALUES(CAST(@i AS varchar(32)), '192.168.1.1 ',5, '202.103.1.57 ',
6, 'http://sina.com.cn ', ' ', 'www.sohu.com ',11,CONVERT(dat