
[dbo].[AccountingCustomer]
CREATE TABLE [dbo].[AccountingCustomer]
(
[AccountingCustomerId] [int] NOT NULL IDENTITY(1, 1),
[Name] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Hidden] [bit] NOT NULL CONSTRAINT [DF_AccountingCustomer_Hidden] DEFAULT ((0)),
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Email] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OnHold] [bit] NOT NULL,
[CreditLimit] [money] NOT NULL,
[NoCreditFlag] [bit] NOT NULL,
[Phone1] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Phone2] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Phone3] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Fax] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Contact] [varchar] (61) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TaxExempt] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AccountingCustomerClassFid] [int] NULL,
[AccountingCustomerPaymentTermsFid] [int] NULL,
[AccountingCustomerCreditLimitTypeFid] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountingCustomer] ADD CONSTRAINT [PK_AccountingCustomer] PRIMARY KEY CLUSTERED ([AccountingCustomerId]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_AccountingCustomer_AccountingCustomerClass_CustomerNumber] ON [dbo].[AccountingCustomer] ([AccountingCustomerClassFid], [CustomerNumber]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_AccountingCustomer_AccountingCustomerPaymentTerms_CustomerNumber] ON [dbo].[AccountingCustomer] ([AccountingCustomerPaymentTermsFid], [CustomerNumber]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_AccountingCustomer_CustomerNumber] ON [dbo].[AccountingCustomer] ([CustomerNumber]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_AccountingCustomer_Name] ON [dbo].[AccountingCustomer] ([Name]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountingCustomer] ADD CONSTRAINT [FK_AccountingCustomer_AccountingCustomerClass] FOREIGN KEY ([AccountingCustomerClassFid]) REFERENCES [dbo].[AccountingCustomerClass] ([AccountingCustomerClassId])
GO
ALTER TABLE [dbo].[AccountingCustomer] ADD CONSTRAINT [FK_AccountingCustomer_AccountingCustomerCreditLimitType] FOREIGN KEY ([AccountingCustomerCreditLimitTypeFid]) REFERENCES [dbo].[AccountingCustomerCreditLimitType] ([AccountingCustomerCreditLimitTypeId])
GO
ALTER TABLE [dbo].[AccountingCustomer] ADD CONSTRAINT [FK_AccountingCustomer_AccountingCustomerPaymentTerms] FOREIGN KEY ([AccountingCustomerPaymentTermsFid]) REFERENCES [dbo].[AccountingCustomerPaymentTerms] ([AccountingCustomerPaymentTermsId])
GO
GRANT SELECT ON [dbo].[AccountingCustomer] TO [MssExec]
GRANT INSERT ON [dbo].[AccountingCustomer] TO [MssExec]
GRANT DELETE ON [dbo].[AccountingCustomer] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountingCustomer] TO [MssExec]
GO