You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a persisted computed column is defined in sql server, example:
column "Deleted" {
type = bit
as {
expr = "convert(bit, case when DeletedDate is not null then 1 else 0 end)"
type = PERSISTED
}
}
has its expr modified, then the generated sql
ALTER TABLE <Name> DROP COLUMN [Deleted];
ALTER TABLE <Name> ADD [Deleted] AS (CONVERT([bit],case when [DeletedDate] IS NOT NULL then (1) else (0) end)) PERSISTED NOT NULL;
-
will fail if there are any indexes referencing this column.
Changing computed persisted column referenced by indexes should probably drop and recreate indexes referencing it if there are any.