CREATE TABLE [dbo].[md_types]
(
[typ_type_name] [dbo].[ais_name] NOT NULL,
[typ_rowver] [timestamp] NOT NULL,
[typ_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[typ_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[typ_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[typ_is_string] [bit] NOT NULL CONSTRAINT [DF__md_types__typ_is_string] DEFAULT ((0)),
[typ_is_dyn] [bit] NOT NULL CONSTRAINT [DF__md_types__typ_is_dyn] DEFAULT ((0)),
[typ_len] [smallint] NOT NULL,
[typ_authorised] [bit] NOT NULL CONSTRAINT [DF__md_types__typ_authorised] DEFAULT ((0)),
[typ_c] [dbo].[ais_name] NULL,
[typ_sql] [dbo].[ais_name] NOT NULL,
[typ_sys] [bit] NOT NULL CONSTRAINT [DF__md_types__typ_sys] DEFAULT ((0)),
[typ_numeric_precision] [smallint] NULL,
[typ_numeric_scale] [smallint] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[md_types] ADD 
CONSTRAINT [PK_md_types] PRIMARY KEY CLUSTERED  ([typ_type_name]) ON [PRIMARY]
ALTER TABLE [dbo].[md_types] ADD
CONSTRAINT [CK__md_types_typ_type_name__string_pk] CHECK ((len(ltrim(rtrim([typ_type_name])))>(0) AND charindex('*',[typ_type_name])=(0) AND charindex('%',[typ_type_name])=(0)))

GO
