CREATE TABLE [dbo].[acc_cts_types]
(
[ctstyp_type_code] [dbo].[ais_code_short] NOT NULL,
[ctstyp_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[ctstyp_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[ctstyp_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[ctstyp_sys] [bit] NOT NULL CONSTRAINT [DF__acc_cts_types__ctstyp_sys] DEFAULT ((0)),
[ctstyp_rank] [tinyint] NOT NULL,
[ctstyp_mark_item] [bit] NOT NULL CONSTRAINT [DF__acc_cts_types__ctstyp_mark_item] DEFAULT ((0)),
[ctstyp_new_sit] [bit] NOT NULL CONSTRAINT [DF__acc_cts_types__ctstyp_new_sit] DEFAULT ((0))
) ON [PRIMARY]
ALTER TABLE [dbo].[acc_cts_types] ADD 
CONSTRAINT [PK_acc_cts_types] PRIMARY KEY CLUSTERED  ([ctstyp_type_code]) ON [PRIMARY]
CREATE UNIQUE NONCLUSTERED INDEX [IX_acc_cts_types_rank] ON [dbo].[acc_cts_types] ([ctstyp_rank]) ON [PRIMARY]

ALTER TABLE [dbo].[acc_cts_types] ADD
CONSTRAINT [CK__acc_cts_types_ctstyp_type_code__string_pk] CHECK ((len(ltrim(rtrim([ctstyp_type_code])))>(0) AND charindex('*',[ctstyp_type_code])=(0) AND charindex('%',[ctstyp_type_code])=(0)))
GO
