CREATE TABLE [dbo].[pol_policies_accounts]
(
[polacc_policy_id] [int] NOT NULL,
[polacc_client_id] [int] NOT NULL,
[polacc_account_number] [varchar] (50) COLLATE French_CI_AS NOT NULL,
[polacc_monthly_payment_code] [dbo].[ais_code_short] NOT NULL,
[polacc_payment_day] [smallint] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pol_policies_accounts] ADD CONSTRAINT [PK_pol_policies_accounts] PRIMARY KEY CLUSTERED  ([polacc_policy_id]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_pol_policies_accounts_lcinet_id_account_number] ON [dbo].[pol_policies_accounts] ([polacc_client_id], [polacc_account_number]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pol_policies_accounts] ADD CONSTRAINT [FK_pol_policies_accounts_act_accounts] FOREIGN KEY ([polacc_client_id], [polacc_account_number]) REFERENCES [dbo].[act_accounts] ([acc_actor_id], [acc_account_number])
GO
ALTER TABLE [dbo].[pol_policies_accounts] ADD CONSTRAINT [FK_pol_policies_accounts_nm_pol_monthly_payments_days] FOREIGN KEY ([polacc_monthly_payment_code], [polacc_payment_day]) REFERENCES [dbo].[nm_pol_monthly_payments_days] ([nmpmpd_monthly_payment_code], [nmpmpd_day])
GO
ALTER TABLE [dbo].[pol_policies_accounts] ADD CONSTRAINT [FK_pol_policies_accounts_pol_policies] FOREIGN KEY ([polacc_policy_id]) REFERENCES [dbo].[pol_policies] ([pol_policy_id])
GO
