CREATE TABLE [dbo].[BcCustomer]
(
[BcCustomerId] [int] NOT NULL IDENTITY(1, 1),
[BcId] [uniqueidentifier] NOT NULL,
[AccountingCustomerFid] [int] NOT NULL,
[CreatedOn] [datetimeoffset] NOT NULL,
[LastImportedOn] [datetimeoffset] NOT NULL,
[LastUpdatedInBcOn] [datetimeoffset] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BcCustomer] ADD CONSTRAINT [PK_BcCustomer] PRIMARY KEY CLUSTERED ([BcCustomerId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BcCustomer] ADD CONSTRAINT [IX_BcCustomer_BcId] UNIQUE NONCLUSTERED ([BcId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BcCustomer] ADD CONSTRAINT [FK_BcCustomer_AccountingCustomer] FOREIGN KEY ([AccountingCustomerFid]) REFERENCES [dbo].[AccountingCustomer] ([AccountingCustomerId]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[BcCustomer] TO [MssExec]
GRANT INSERT ON [dbo].[BcCustomer] TO [MssExec]
GRANT DELETE ON [dbo].[BcCustomer] TO [MssExec]
GRANT UPDATE ON [dbo].[BcCustomer] TO [MssExec]
GO