栏目导航
热点推荐
- 心得:Sql语句绝妙用法
- SQL Server数据转换服务小妙招
- SQL Server数据库常用的T-SQL命
- 详解SQLServer 存储过程
- SQL数据库挂马解决方案
- 分析 SQL Server 的内存为何不断
- SQL Server数据库查询速度慢的原
- 详细讲解删除SQL Server日志的具
- 三步骤快速创建SQL Server数据库
- SQL Server事务日志的几个常用操
- SQLServer应用程序中的高级SQL注
- 使用SQL Server 2008进行服务器
阅览排行
使用SQL Server 2008实现可调窗口应用
www.jz123.cn 2009-12-25 来源: 我要投递新闻
注意: 您可以复制此练习中所用的脚本,这些脚本位于 C:SQLHOLSPartitioningSolutionPartition Processing 文件夹中的 Partition Processing.ssmssln 解决方案中。
1.为存档表创建分区函数
(1)在解决方案资源管理器中,右键单击该连接,然后单击新建查询。
(2)右键单击 SQLQuery1.sql,然后单击重命名。
(3)键入 Create Archive Partition Function.sql,然后按 Enter。
(4)键入下面的代码。
CREATE PARTITION FUNCTION pf_OrderDateKeyArchive(int)
AS RANGE RIGHT
FOR VALUES(185)
GO
5.单击执行。
2.为存档表创建分区方案
(1)在解决方案资源管理器中,右键单击该连接,然后单击新建查询。
(2)右键单击 SQLQuery1.sql,然后单击重命名。
(3)键入 Create Archive Partition Scheme.sql,然后按 Enter。
(4)键入下面的代码。
CREATE PARTITION SCHEME ps_OrderDateKeyArchive
AS PARTITION pf_OrderDateKeyArchive
TO (fg2001,fg2002,fg2003)
GO
(5)单击执行。
3.为存档数据创建分区表
(1)在解决方案资源管理器中,右键单击该连接,然后单击新建查询。
(2)右键单击 SQLQuery1.sql,然后单击重命名。
(3)键入 Create Archive Table.sql,然后按 Enter。
(4)键入下面的代码。
CREATE TABLE [dbo].[FactInternetSalesArchive]
(
[InternetSalesID] [int] IDENTITY(1,1) NOT NULL,
[ProductKey] [int] NOT NULL,
[OrderDateKey] [int] NOT NULL,
[DueDateKey] [int] NOT NULL,
[ShipDateKey] [int] NOT NULL,
[CustomerKey] [int] NOT NULL,
[PromotionKey] [int] NOT NULL,
[CurrencyKey] [int] NOT NULL,
[SalesTerritoryKey] [int] NOT NULL,
[SalesOrderNumber] [nvarchar](20) NOT NULL,
[OrderQuantity] [smallint] NULL,
[UnitPrice] [money] NULL,
CONSTRAINT [PK_ FactInternetSalesArchive] PRIMARY KEY CLUSTERED
(
[InternetSalesID],
[ProductKey],
[OrderDateKey],
[DueDateKey],
[ShipDateKey],
[CustomerKey],
[PromotionKey],
[CurrencyKey],
[SalesTerritoryKey]
)
)
ON ps_OrderDateKeyArchive(OrderDateKey)
GO
(5)单击执行。
上一篇:如何应对锁住的数据记录:NOLOCK和READPAST 下一篇:详解SQL Server 2008滑动窗口的管理