CREATE TABLE [dbo].[int_retrocessions]
(
[iret_retro_code] [dbo].[ais_code_short] NOT NULL,
[iret_l1] [nvarchar] (64) COLLATE French_CI_AS NOT NULL,
[iret_l2] [nvarchar] (64) COLLATE French_CI_AS NULL,
[iret_l3] [nvarchar] (64) COLLATE French_CI_AS NULL,
[iret_type_retro_code] [dbo].[ais_code_medium] NOT NULL,
[iret_value] [dbo].[ais_decimal2] NULL,
[iret_fixed_value] [bit] NOT NULL CONSTRAINT [DF__int_retrocessions__iret_fixed_value] DEFAULT ((0)),
[iret_subscription_only] [bit] NOT NULL CONSTRAINT [DF__int_retrocessions__iret_subscription_only] DEFAULT ((0)),
[iret_continue] [bit] NOT NULL CONSTRAINT [DF__int_retrocessions__iret_continue] DEFAULT ((0)),
[iret_broker_cost_value] [dbo].[ais_decimal2] NULL,
[iret_broker_cost_fixed_value] [bit] NOT NULL CONSTRAINT [DF__int_retrocessions__iret_broker_cost_fixed_value] DEFAULT ((0)),
[iret_broker_fee_value] [dbo].[ais_decimal2] NULL,
[iret_broker_fee_fixed_value] [bit] NOT NULL CONSTRAINT [DF__int_retrocessions__iret_broker_fee_fixed_value] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[int_retrocessions] ADD CONSTRAINT [CK__int_retrocessions_iret_retro_code__string_pk] CHECK ((len(ltrim(rtrim([iret_retro_code])))>(0) AND charindex('*',[iret_retro_code])=(0) AND charindex('%',[iret_retro_code])=(0)))
GO
ALTER TABLE [dbo].[int_retrocessions] ADD CONSTRAINT [PK_int_retrocessions] PRIMARY KEY NONCLUSTERED  ([iret_retro_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[int_retrocessions] ADD CONSTRAINT [FK_int_retrocessions_nm_types_retro] FOREIGN KEY ([iret_type_retro_code]) REFERENCES [dbo].[nm_types_retro] ([nmtr_type_retro_code])
GO
