Computed Column Bit based on other Bit Columns What would be the formula to compute a bit column from other bit columns?

For example:

CREATE TABLE #Employee
(
[empNumb]       [INT] identity(1,1) PRIMARY KEY,
[IsOk]          [BIT] NOT NULL, -- This is computed from other three columns.
[HasValidHours] [BIT] NOT NULL,
[NoDemerits]    [BIT] NOT NULL,
[NoAccidents]   [BIT] NOT NULL
);

ALTER TABLE #Employee ADD CONSTRAINT [DF_Employee_HasValidHours]  
  DEFAULT ((0)) FOR [HasValidHours];
ALTER TABLE #Employee ADD CONSTRAINT [DF_Employee_NoDemerits]  
  DEFAULT ((0)) FOR [NoDemerits];
ALTER TABLE #Employee ADD CONSTRAINT [DF_Employee_NoAccidents]  
  DEFAULT ((0)) FOR [NoAccidents];


IsOk would be computed from the and-ing of HasValidHours, NoDemerits and NoAccidents.
Do you mean IsOk = 1 if the other three bit columns all = 1 else IsOk = 0?

If so: -

CREATE TABLE #Employee
(
[empNumb]       [INT] identity(1,1) PRIMARY KEY,
[IsOk]          AS [HasValidHours] &amp; [NoDemerits] &amp; [NoAccidents],
[HasValidHours] [BIT] NOT NULL,
[NoDemerits]    [BIT] NOT NULL,
[NoAccidents]   [BIT] NOT NULL
);


See &amp; (Bitwise AND) (Transact-SQL)