CREATE TABLE [dbo].[CBRegisterDistributions]
(
[RegisterID] [int] NOT NULL,
[BalanceSheetGroupID] [int] NOT NULL,
[Amount] [money] NULL,
[CreatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_CBRegisterDistributions_CreateDate] DEFAULT (getdate()),
[UpdatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_CBRegisterDistributions_LastUpdate] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CBRegisterDistributions] ADD CONSTRAINT [PK_CBRegisterDistributions] PRIMARY KEY CLUSTERED ([RegisterID], [BalanceSheetGroupID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CBRegisterDistributions] ADD CONSTRAINT [FK_CBRegisterDistributions_BalanceSheetGroupID_GLBalanceSheetGroups] FOREIGN KEY ([BalanceSheetGroupID]) REFERENCES [dbo].[GLBalanceSheetGroups] ([BalanceSheetGroupID])
GO
ALTER TABLE [dbo].[CBRegisterDistributions] ADD CONSTRAINT [FK_CBRegisterDistributions_RegisterID_CBRegister] FOREIGN KEY ([RegisterID]) REFERENCES [dbo].[CBRegister] ([RegisterID])
GO