当我尝试更新此语句时出现错误:
询问:
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[TBL]') AND name = N'INDX NAME')
BEGIN
--DROP INDEX [INDX] ON [dbo].[TBL]
ALTER INDEX [INDEX] ON [dbo].[TBL] DISABLE
END
UPDATE dbo.TBL
SET Organization_Id= CASE Org_Id WHEN @O_hf THEN @HF WHEN @O_hg THEN @HG ELSE Orga_ID END
where Org_Id in (@O_hf,@O_hg)
IF EXISTS (SELECT * FROM sys.change_tracking_tables where object_id=OBJECT_ID(N'[dbo].[TBL]'))
ALTER TABLE dbo.TBL
DISABLE CHANGE_TRACKING;
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[TBL]') AND name = N'INDX NAME')
BEGIN
ALTER INDEX [INDEX] ON [dbo].[TBL] REBUILD
END
它会抛出以下错误
消息 35330,级别 15,状态 1,第 2 行 UPDATE 语句失败,因为无法在具有列存储索引的表中更新数据。考虑在发出 UPDATE 语句之前禁用列存储索引,然后在 UPDATE 完成后重建列存储索引。