CREATE TABLE [dbo].[pr_products_introducers_commission_sharings]
(
[prdintr_product_code] [dbo].[ais_code_short] NOT NULL,
[prdintr_branch_id] [int] NOT NULL,
[prdintr_introducer_id] [int] NOT NULL,
[prdintr_retro_code] [dbo].[ais_code_short] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pr_products_introducers_commission_sharings] ADD CONSTRAINT [CK__pr_products_introducers_commission_sharings_prdintr_retro_code__string_pk] CHECK ((len(ltrim(rtrim([prdintr_retro_code])))>(0) AND charindex('*',[prdintr_retro_code])=(0) AND charindex('%',[prdintr_retro_code])=(0)))
GO
ALTER TABLE [dbo].[pr_products_introducers_commission_sharings] ADD CONSTRAINT [PK_pr_products_introducers_commission_sharings] PRIMARY KEY CLUSTERED ([prdintr_product_code], [prdintr_branch_id], [prdintr_introducer_id], [prdintr_retro_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pr_products_introducers_commission_sharings] ADD CONSTRAINT [FK_pr_products_introducers_commission_sharings_pr_products_introducers] FOREIGN KEY ([prdintr_product_code], [prdintr_branch_id], [prdintr_introducer_id]) REFERENCES [dbo].[pr_products_introducers] ([prdint_product_code], [prdint_branch_id], [prdint_introducer_id])
GO
