Turn off system versioning of temporal table that is used in indexed views

2.5k Views Asked by At

I have a table that is used by a number of indexed views that I want to convert to a temporal table. All the commands to add the necessary columns and to set SYSTEM_VERSIONING=ON with a history table all succeeded. But now I can not disable system versioning with this command

ALTER TABLE [dbo].[MyTable] SET(SYSTEM_VERSIONING = OFF);

I get the error Cannot ALTER 'MyTable' because it is being referenced by object 'MyIndexedViewThatReferencesMyTable'.

It seems impractical to delete all views, alter MyTable, then recreate all views in order to accomplish this. Is there another way to get this table back to non-temporal?

0

There are 0 best solutions below