如何通过指定文件组创建临时 table?

How can I create a temporal table by specifying file groups?

我为历史操作创建了一个系统版本控制 table,但我想为临时 table.

指定一个单独的文件组,例如 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

如果有人能指导我,我将不胜感激。

据我了解,您希望主 table 位于一个文件组中,而存档位于另一个文件组中。您可以尝试通过历史记录 table 的对象资源管理器编写 'Drop and Create to' 选项的脚本,并指定您希望聚集索引位于哪个文件组。