
[dbo].[FactoringCustomer]
CREATE TABLE [dbo].[FactoringCustomer]
(
[FactoringCustomerID] [int] NOT NULL IDENTITY(1, 1),
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AccountingCustomerFid] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FactoringCustomer] ADD CONSTRAINT [PK_FactoringCustomer] PRIMARY KEY NONCLUSTERED ([FactoringCustomerID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FactoringCustomer] ADD CONSTRAINT [IX_FactoringCustomer_CustomerNumber] UNIQUE NONCLUSTERED ([CustomerNumber]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_FactoringCustomer_AccountingCustomerFid] ON [dbo].[FactoringCustomer] ([AccountingCustomerFid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FactoringCustomer] ADD CONSTRAINT [FK_FactoringCustomer_AccountingCustomer] FOREIGN KEY ([AccountingCustomerFid]) REFERENCES [dbo].[AccountingCustomer] ([AccountingCustomerId])
GO
GRANT SELECT ON [dbo].[FactoringCustomer] TO [MssExec]
GRANT INSERT ON [dbo].[FactoringCustomer] TO [MssExec]
GRANT DELETE ON [dbo].[FactoringCustomer] TO [MssExec]
GRANT UPDATE ON [dbo].[FactoringCustomer] TO [MssExec]
GO