我在 Windows Sever 2012 R2 上运行 SQL Server 2016 SP1 (13.0.4001)。我有下表。
CREATE TABLE [SubEx].[Ingredients](
[IngredientId] [int] IDENTITY(1,2) NOT NULL,
[IngredientName] [nvarchar](328) NOT NULL,
[IngredientShortDescription] [nvarchar](328) NOT NULL,
[PortionUOMTypeId] [smallint] NULL,
[WISRTypeId] [smallint] NOT NULL,
[WISRSubTypeId] [smallint] NULL,
[FlavorTypeId] [smallint] NULL,
[StatusTypeId] [smallint] NOT NULL,
[IsMandatory] [bit] NOT NULL,
[IsDownloaded] [bit] NOT NULL,
[CreatedDT] [datetime] NOT NULL,
[CreatedBy] [int] NOT NULL,
[LastUpdateDT] [datetime] NULL,
[LastUpdateBy] [int] NULL,
[Deleted] [bit] NOT NULL,
[DeletedDT] [datetime] NULL,
[DeletedBy] [int] NULL,
[CreatedUserName] [nvarchar](136) NOT NULL,
[UpdatedUserName] [nvarchar](136) NULL,
[DeletedUserName] [nvarchar](136) NULL,
[ValidFrom] [datetime2](2) GENERATED ALWAYS AS ROW START NOT NULL,
[ValidTo] [datetime2](2) GENERATED ALWAYS AS ROW END NOT NULL,
CONSTRAINT [PK_Ingredients_IngredientId] PRIMARY KEY CLUSTERED
(
[IngredientId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY],
PERIOD FOR SYSTEM_TIME ([ValidFrom], [ValidTo])
) ON [PRIMARY]
GO
ALTER TABLE [SubEx].[Ingredients] ADD CONSTRAINT [DF_Ingredients_IsMandatory] DEFAULT ((0)) FOR [IsMandatory]
GO
ALTER TABLE [SubEx].[Ingredients] ADD CONSTRAINT [DF_Ingredients_IsDownloaded] DEFAULT ((0)) FOR [IsDownloaded]
GO
ALTER TABLE [SubEx].[Ingredients] ADD CONSTRAINT [DF_Ingredients_Deleted] DEFAULT ((0)) FOR [Deleted]
GO
ALTER TABLE [SubEx].[Ingredients] ADD CONSTRAINT [DF_ValidFrom] DEFAULT (dateadd(second,(-1),sysutcdatetime())) FOR [ValidFrom]
GO
ALTER TABLE [SubEx].[Ingredients] ADD CONSTRAINT [DF_ValidTo] DEFAULT ('9999.12.31 23:59:59.99') FOR [ValidTo]
GO
ALTER TABLE [SubEx].[Ingredients] WITH CHECK ADD CONSTRAINT [FK_Ingredients_TlkpFlavorTypes_FlavorTypeId] FOREIGN KEY([FlavorTypeId])
REFERENCES [SubEx].[TlkpFlavorTypes] ([FlavorTypeId])
GO
ALTER TABLE [SubEx].[Ingredients] CHECK CONSTRAINT [FK_Ingredients_TlkpFlavorTypes_FlavorTypeId]
GO
ALTER TABLE [SubEx].[Ingredients] WITH CHECK ADD CONSTRAINT [FK_Ingredients_TlkpStatusTypes_StatusTypeId] FOREIGN KEY([StatusTypeId])
REFERENCES [SubEx].[TlkpStatusTypes] ([StatusTypeId])
GO
ALTER TABLE [SubEx].[Ingredients] CHECK CONSTRAINT [FK_Ingredients_TlkpStatusTypes_StatusTypeId]
GO
ALTER TABLE [SubEx].[Ingredients] WITH CHECK ADD CONSTRAINT [FK_Ingredients_TlkpWISRCategoryTypes_WISRTypeId] FOREIGN KEY([WISRTypeId])
REFERENCES [SubEx].[TlkpWISRCategoryTypes] ([WISRTypeId])
GO
ALTER TABLE [SubEx].[Ingredients] CHECK CONSTRAINT [FK_Ingredients_TlkpWISRCategoryTypes_WISRTypeId]
GO
ALTER TABLE [SubEx].[Ingredients] WITH CHECK ADD CONSTRAINT [FK_Ingredients_TlkpWISRSubCategoryTypes_WISRSubTypeId] FOREIGN KEY([WISRSubTypeId])
REFERENCES [SubEx].[TlkpWISRSubCategoryTypes] ([WISRSubTypeId])
GO
ALTER TABLE [SubEx].[Ingredients] CHECK CONSTRAINT [FK_Ingredients_TlkpWISRSubCategoryTypes_WISRSubTypeId]
GO
当我运行以下脚本为我的临时表启用 SYSTEM_VERSIONING 时,我收到以下错误消息和堆栈转储。
ALTER TABLE SubEx.Ingredients
SET (SYSTEM_VERSIONING = ON (HISTORY_TABLE = SubEx.IngredientsHistory));
消息 596,级别 21,状态 1,第 8 行无法继续执行,因为会话处于终止状态。
消息 0,级别 20,状态 0,第 8 行当前命令发生严重错误。结果,如果有的话,应该被丢弃。
我是在做错什么还是需要向 Microsoft 提交错误?
这可能是你的问题:
在 SQL Server 2016 中的表上启用系统版本控制时会生成转储文件
尝试安装 Sql 2016 SP1 的 CU1