[dbo].[CustomerStatement]
CREATE TABLE [dbo].[CustomerStatement]
(
[CustomerStatementID] [int] NOT NULL IDENTITY(1, 1),
[CustomerStatementRunFID] [int] NOT NULL,
[CustomerName] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerAddress1] [varchar] (61) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerAddress2] [varchar] (61) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerAddress3] [varchar] (61) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerCity] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerState] [varchar] (29) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerPostalCode] [varchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[PaymentTerms] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CurrentAmount] [money] NOT NULL,
[From30To60Amount] [money] NOT NULL,
[From61To90Amount] [money] NOT NULL,
[From91To120Amount] [money] NOT NULL,
[GreaterThan120Amount] [money] NOT NULL,
[CustomerClass] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[StatementCycle] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Balance] [money] NOT NULL CONSTRAINT [DF_CustomerStatement_Balance] DEFAULT ((0)),
[StatementName] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerCountry] [varchar] (61) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[EmailAddress] [varchar] (201) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatement] ADD CONSTRAINT [PK_CustomerStatement] PRIMARY KEY NONCLUSTERED ([CustomerStatementID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_CustomerStatement_StatementRunFID] ON [dbo].[CustomerStatement] ([CustomerStatementRunFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatement] ADD CONSTRAINT [FK_CustomerStatement_CustomerStatementRun] FOREIGN KEY ([CustomerStatementRunFID]) REFERENCES [dbo].[CustomerStatementRun] ([CustomerStatementRunID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[CustomerStatement] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerStatement] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerStatement] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerStatement] TO [MssExec]
GO