CREATE TABLE [dbo].[dyn_forms]
(
[frm_form_code] [dbo].[ais_code_short] NOT NULL,
[frm_rowver] [timestamp] NOT NULL,
[frm_type_code] [dbo].[ais_code_short] NOT NULL,
[frm_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[frm_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[frm_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[frm_assembly] [image] NULL,
[frm_xml_form_definition] [image] NULL,
[frm_assembly_namespace] [varchar] (128) COLLATE French_CI_AS NULL,
[frm_available_fields] [varchar] (max) COLLATE French_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
ALTER TABLE [dbo].[dyn_forms] ADD
CONSTRAINT [CK__dyn_forms_frm_form_code__string_pk] CHECK ((len(ltrim(rtrim([frm_form_code])))>(0) AND charindex('*',[frm_form_code])=(0) AND charindex('%',[frm_form_code])=(0)))
GO
ALTER TABLE [dbo].[dyn_forms] ADD CONSTRAINT [PK_dyn_forms] PRIMARY KEY CLUSTERED  ([frm_form_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[dyn_forms] WITH NOCHECK ADD CONSTRAINT [FK_dyn_forms_dyn_types] FOREIGN KEY ([frm_type_code]) REFERENCES [dbo].[dyn_types] ([dt_type_code])
GO
