CREATE TABLE [dbo].[sq_sequences]
(
[seq_sequence_code] [dbo].[ais_code_short] NOT NULL,
[seq_type_code] [dbo].[ais_code_short] NOT NULL,
[seq_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[seq_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[seq_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[seq_prefix] [dbo].[ais_code_medium] NULL,
[seq_counter_size] [tinyint] NOT NULL,
[seq_pad_zero] [bit] NOT NULL CONSTRAINT [DF__sq_sequences__seq_pad_zero] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[sq_sequences] ADD CONSTRAINT [CK__sq_sequences_seq_sequence_code__string_pk] CHECK ((len(ltrim(rtrim([seq_sequence_code])))>(0) AND charindex('*',[seq_sequence_code])=(0) AND charindex('%',[seq_sequence_code])=(0)))
GO
ALTER TABLE [dbo].[sq_sequences] ADD CONSTRAINT [CK_sq_sequences] CHECK (([seq_counter_size]>(0)))
GO
ALTER TABLE [dbo].[sq_sequences] ADD CONSTRAINT [PK_sq_sequences] PRIMARY KEY CLUSTERED  ([seq_sequence_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[sq_sequences] ADD CONSTRAINT [FK_sq_sequences_sq_types] FOREIGN KEY ([seq_type_code]) REFERENCES [dbo].[sq_types] ([seqt_code])
GO
