CREATE TABLE [dbo].[acc_trn_bordereaux_departments]
(
[trnbdep_bordereau_id] [int] NOT NULL,
[trnbdep_branch_id] [int] NOT NULL,
[trnbdep_department_code] [dbo].[ais_code_medium] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_trn_bordereaux_departments] ADD CONSTRAINT [PK_acc_trn_bordereaux_departments] PRIMARY KEY CLUSTERED  ([trnbdep_bordereau_id], [trnbdep_branch_id], [trnbdep_department_code]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_trn_bordereaux_departments] ADD CONSTRAINT [FK_acc_trn_bordereaux_departments_acc_trn_bordereaux] FOREIGN KEY ([trnbdep_bordereau_id]) REFERENCES [dbo].[acc_trn_bordereaux] ([trnb_bordereau_id])
GO
ALTER TABLE [dbo].[acc_trn_bordereaux_departments] ADD CONSTRAINT [FK_acc_trn_bordereaux_departments_act_branches_departments] FOREIGN KEY ([trnbdep_branch_id], [trnbdep_department_code]) REFERENCES [dbo].[act_branches_departments] ([brdep_branch_id], [brdep_department_code])
GO
