我正在处理一个表具有多个计算列的代码。我们可以这样做吗?我已经尝试过以下代码,但它不起作用。
CREATE TABLE CRM_Doctor_Request_old(
Id int NULL,[Event_Type_Id] [bit] NULL,
Compute_Event_Type AS CASE WHEN Event_Type_Id=1 Then 'Individual' WHEN Event_Type_Id=0 Then 'Group' PERSISTED,
CRM_State_Id smallint NULL,
Compute_CRM_State AS CASE WHEN CRM_State_Id=1 Then 'Pending' WHEN CRM_State_Id=2 Then 'Approved' WHEN CRM_State_Id=3 Then 'Cancelled' PERSISTED,
Service_State_Id smallint NULL,
CRM_Service_State AS CASE WHEN Service_State_Id=1 Then 'In queue' WHEN Service_State_Id=2 Then 'In Process' WHEN Service_State_Id=3 Then 'Completed' WHEN Service_State_Id=3 Then 'Cancelled' PERSISTED
);