CREATE TABLE [dbo].[pol_variables]
(
[polv_policy_situation_id] [int] NOT NULL,
[polv_variable_id] [int] NOT NULL,
[polv_premium] [dbo].[ais_decimal2] NULL,
[polv_premium_splited] [dbo].[ais_decimal2] NULL,
[polv_premium_indexed] [dbo].[ais_decimal2] NULL,
[polv_premium_splited_indexed] [dbo].[ais_decimal2] NULL,
[polv_tf] [dbo].[ais_decimal2] NULL,
[polv_taxes] [dbo].[ais_decimal2] NULL,
[polv_ti] [dbo].[ais_decimal2] NULL,
[polv_fmt_code__premium] [dbo].[ais_code_short] NULL,
[polv_franchise_mini] [dbo].[ais_decimal2] NULL,
[polv_fmt_code__franchise_mini] [dbo].[ais_code_short] NULL,
[polv_franchise_maxi] [dbo].[ais_decimal2] NULL,
[polv_fmt_code__franchise_maxi] [dbo].[ais_code_short] NULL,
[polv_franchise] [dbo].[ais_decimal2] NULL,
[polv_fmt_code__franchise] [dbo].[ais_code_short] NULL,
[polv_capital] [dbo].[ais_decimal2] NULL,
[polv_fmt_code__capital] [dbo].[ais_code_short] NULL,
[polv_coef] [dbo].[ais_decimal4] NULL,
[polv_umr_value] [varchar] (30) COLLATE French_CI_AS NULL,
[polv_mbcomm_value] [dbo].[ais_decimal4] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[pol_variables] ADD 
CONSTRAINT [PK_pol_variables] PRIMARY KEY CLUSTERED  ([polv_policy_situation_id], [polv_variable_id]) ON [PRIMARY]

GO

ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_nm_formats3] FOREIGN KEY ([polv_fmt_code__capital]) REFERENCES [dbo].[nm_formats] ([fmt_fmt_code])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_nm_formats2] FOREIGN KEY ([polv_fmt_code__franchise]) REFERENCES [dbo].[nm_formats] ([fmt_fmt_code])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_nm_formats1] FOREIGN KEY ([polv_fmt_code__franchise_maxi]) REFERENCES [dbo].[nm_formats] ([fmt_fmt_code])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_nm_formats] FOREIGN KEY ([polv_fmt_code__franchise_mini]) REFERENCES [dbo].[nm_formats] ([fmt_fmt_code])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_nm_formats4] FOREIGN KEY ([polv_fmt_code__premium]) REFERENCES [dbo].[nm_formats] ([fmt_fmt_code])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_pol_policies_situations1] FOREIGN KEY ([polv_policy_situation_id]) REFERENCES [dbo].[pol_policies_situations] ([pols_policy_situation_id])
GO
ALTER TABLE [dbo].[pol_variables] ADD CONSTRAINT [FK_pol_variables_pr_products_variables] FOREIGN KEY ([polv_variable_id]) REFERENCES [dbo].[pr_products_variables] ([prdv_variable_id])
GO
