Inter-dependent columns
Posted: Wed 16 Dec 2020 17:28
Hi,
I have a table with the following schema:
The values within 'IsLocked', 'DateLocked', and 'LockedBy' are all dependent on each other. Meaning that 'DateLocked' and 'LockedBy' should only contain values when 'IsLocked' has a value of '1'.
How can I set the population of the 'DateLocked' and 'LockedBy' columns to only contain data when the generated value of 'IsLocked' is equal to '1'?
Thank you for your time.
Dave
I have a table with the following schema:
Code: Select all
CREATE TABLE [dbo].[Content](
[Id] [int] IDENTITY(1,1) NOT NULL,
[IsLocked] [bit] NULL,
[DateLocked] [datetime] NULL,
[LockedBy] [varchar](200) NULL,
[Region] [varchar](5) NOT NULL,
CONSTRAINT [PK_Content] PRIMARY KEY CLUSTERED
How can I set the population of the 'DateLocked' and 'LockedBy' columns to only contain data when the generated value of 'IsLocked' is equal to '1'?
Thank you for your time.
Dave