我为历史记录操作创建了一个系统版本控制表,但是我想为临时表指定一个单独的文件组,例如FG_History
。
如何更改以下查询:
CREATE TABLE [dbo].[ExpenseCenter]
(
[ExpenseCenterId] [tinyint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](200) NOT NULL,
[SysStartTime] datetime2 (2) GENERATED ALWAYS AS ROW START,
[SysEndTime] datetime2 (2) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime),
CONSTRAINT [PK_ExpenseCenter]
PRIMARY KEY CLUSTERED ([ExpenseCenterId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [FG_INDEX],
CONSTRAINT [UK_ExpenseCenterName]
UNIQUE NONCLUSTERED ([Name] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [FG_INDEX]
) ON [FG_DATA]
WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = history.ExpenseCenterHistory))
GO
如果有人能指导我,我将不胜感激。
答案 0 :(得分:5)
如果我理解,您希望主表位于一个文件组而另一个文件组存档。您可以尝试编写“删除和创建”脚本。通过对象资源管理器选择历史记录表,并指定您希望聚集索引所在的文件组。