This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Steps to alter a column in a Temporal Table | |
e.g. Table "Employee" versioned by "EmployeeHistory", change column "LastName" from Null to Not Null | |
*/ | |
ALTER TABLE [dbo].[Employee] SET (SYSTEM_VERSIONING = OFF); | |
-- fix any null entries in the primary and history tables: | |
UPDATE dbo.Employee SET [LastName] = '' WHERE [LastName] IS NULL; | |
EXEC('UPDATE dbo.EmployeeHistory SET [LastName] = '''' WHERE [LastName] IS NULL'); |
NewerOlder