CREATE TABLE [dbo].[acc_invoices_risks_variables_taxes]
(
[invrisvt_invoice_id] [int] NOT NULL,
[invrisvt_risk_situation_id] [int] NOT NULL,
[invrisvt_variable_id] [int] NOT NULL,
[invrisvt_tax_id] [int] NOT NULL,
[invrisvt_tax_value] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_taxes] ADD CONSTRAINT [PK_acc_invoices_risks_variables_taxes] PRIMARY KEY CLUSTERED  ([invrisvt_invoice_id], [invrisvt_risk_situation_id], [invrisvt_variable_id], [invrisvt_tax_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_taxes] ADD CONSTRAINT [FK_acc_invoices_risks_variables_taxes_acc_invoices_risks_variables] FOREIGN KEY ([invrisvt_invoice_id], [invrisvt_risk_situation_id], [invrisvt_variable_id]) REFERENCES [dbo].[acc_invoices_risks_variables] ([invrisv_invoice_id], [invrisv_risk_situation_id], [invrisv_variable_id])
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_taxes] ADD CONSTRAINT [FK_acc_invoices_risks_variables_taxes_ris_variables_taxes] FOREIGN KEY ([invrisvt_risk_situation_id], [invrisvt_variable_id], [invrisvt_tax_id]) REFERENCES [dbo].[ris_variables_taxes] ([risvt_risk_situation_id], [risvt_variable_id], [risvt_tax_id])
GO
