CREATE TABLE [dbo].[act_csp]
(
[csp_fam_code] [dbo].[ais_code_short] NOT NULL,
[csp_csp_code] [dbo].[ais_code_short] NOT NULL,
[csp_rowver] [timestamp] NOT NULL,
[csp_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[csp_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[csp_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[csp_act_scen_code] [dbo].[ais_code_short] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[act_csp] ADD
CONSTRAINT [CK__act_csp_csp_csp_code__string_pk] CHECK ((len(ltrim(rtrim([csp_csp_code])))>(0) AND charindex('*',[csp_csp_code])=(0) AND charindex('%',[csp_csp_code])=(0)))

GO
ALTER TABLE [dbo].[act_csp] ADD CONSTRAINT [PK_act_csp] PRIMARY KEY CLUSTERED  ([csp_fam_code], [csp_csp_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[act_csp] ADD CONSTRAINT [FK_act_csp_dyn_scenarios] FOREIGN KEY ([csp_act_scen_code]) REFERENCES [dbo].[dyn_scenarios] ([sc_scen_code])
GO
ALTER TABLE [dbo].[act_csp] ADD CONSTRAINT [FK_act_csp_act_fam_csp] FOREIGN KEY ([csp_fam_code]) REFERENCES [dbo].[act_fam_csp] ([fcsp_fam_code])
GO
