CREATE TABLE [dbo].[acc_invoices_risks_situations]
(
[invris_invoice_id] [int] NOT NULL,
[invris_risk_situation_id] [int] NOT NULL,
[invris_start_date] [date] NULL,
[invris_end_date] [date] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[acc_invoices_risks_situations] ADD
CONSTRAINT [FK_acc_invoices_risk_situations_acc_invoices] FOREIGN KEY ([invris_invoice_id]) REFERENCES [dbo].[acc_invoices] ([inv_invoice_id])



GO
ALTER TABLE [dbo].[acc_invoices_risks_situations] ADD CONSTRAINT [PK_acc_invoices_risk_situations] PRIMARY KEY CLUSTERED  ([invris_invoice_id], [invris_risk_situation_id]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[acc_invoices_risks_situations] ADD CONSTRAINT [FK_acc_invoices_risks_situations_ris_risks_situations] FOREIGN KEY ([invris_risk_situation_id]) REFERENCES [dbo].[ris_risks_situations] ([riss_risk_situation_id])
GO
