CREATE TABLE [dbo].[acc_payments]
(
[pay_payment_id] [int] NOT NULL,
[pay_obs] [nvarchar] (64) COLLATE French_CI_AS NULL,
[pay_lettering] [int] NOT NULL,
[pay_branch_id] [int] NOT NULL,
[pay_department_code] [dbo].[ais_code_medium] NOT NULL,
[pay_user_code] [dbo].[ais_code_medium] NOT NULL,
[pay_taken] [bit] NOT NULL CONSTRAINT [DF__acc_payments__pay_taken] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_payments] ADD CONSTRAINT [PK_acc_payments] PRIMARY KEY CLUSTERED  ([pay_payment_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_payments] ADD CONSTRAINT [FK_acc_payments_acc_accounts] FOREIGN KEY ([pay_payment_id]) REFERENCES [dbo].[acc_accounts] ([a_account_id])
GO
ALTER TABLE [dbo].[acc_payments] ADD CONSTRAINT [FK_acc_payments_act_branches_departments] FOREIGN KEY ([pay_branch_id], [pay_department_code]) REFERENCES [dbo].[act_branches_departments] ([brdep_branch_id], [brdep_department_code])
GO
ALTER TABLE [dbo].[acc_payments] ADD CONSTRAINT [FK_acc_payments_usr_users] FOREIGN KEY ([pay_user_code]) REFERENCES [dbo].[usr_users] ([usr_user_code])
GO
