CREATE TABLE [dbo].[dyn_scenarios]
(
[sc_scen_code] [dbo].[ais_code_short] NOT NULL,
[sc_rowver] [timestamp] NOT NULL,
[sc_type_code] [dbo].[ais_code_short] NOT NULL,
[sc_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[sc_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[sc_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[sc_position_code] [dbo].[ais_code_short] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[dyn_scenarios] ADD CONSTRAINT [CK__dyn_scenarios_sc_scen_code__string_pk] CHECK ((len(ltrim(rtrim([sc_scen_code])))>(0) AND charindex('*',[sc_scen_code])=(0) AND charindex('%',[sc_scen_code])=(0)))
GO
ALTER TABLE [dbo].[dyn_scenarios] ADD CONSTRAINT [PK_dyn_scen] PRIMARY KEY CLUSTERED  ([sc_scen_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[dyn_scenarios] ADD CONSTRAINT [FK_dyn_scenarios_nm_positions] FOREIGN KEY ([sc_position_code]) REFERENCES [dbo].[nm_positions] ([pos_position_code])
GO
ALTER TABLE [dbo].[dyn_scenarios] ADD CONSTRAINT [FK_dyn_scenarios_dyn_types] FOREIGN KEY ([sc_type_code]) REFERENCES [dbo].[dyn_types] ([dt_type_code])
GO
