CREATE TABLE [dbo].[XLedgerCustomer]
(
[XLedgerCustomerId] [int] NOT NULL IDENTITY(1, 1),
[ExternalDbId] [int] NOT NULL,
[AccountingCustomerFid] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XLedgerCustomer] ADD CONSTRAINT [PK_XLedgerCustomer] PRIMARY KEY NONCLUSTERED ([XLedgerCustomerId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XLedgerCustomer] ADD CONSTRAINT [IX_XLedgerCustomer_ExternalDbId] UNIQUE CLUSTERED ([XLedgerCustomerId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XLedgerCustomer] ADD CONSTRAINT [FK_XLedgerCustomer_AccountingCustomer] FOREIGN KEY ([AccountingCustomerFid]) REFERENCES [dbo].[AccountingCustomer] ([AccountingCustomerId])
GO
GRANT SELECT ON [dbo].[XLedgerCustomer] TO [MssExec]
GRANT INSERT ON [dbo].[XLedgerCustomer] TO [MssExec]
GRANT DELETE ON [dbo].[XLedgerCustomer] TO [MssExec]
GRANT UPDATE ON [dbo].[XLedgerCustomer] TO [MssExec]
GO