Tables [dbo].[StatementDocument]
Properties
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
Row Count (~)220258
Created4:57:09 PM Thursday, September 7, 2006
Last Modified9:09:28 AM Thursday, May 23, 2024
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentityDefault
Cluster Primary Key PK_StatementDocument: SDPriKeySDPriKeyint4
No
1 - 1
Indexes IX_StatementDocument_Order_DocNo: OrdPriKey\DocumentNumberDocumentNumbervarchar(23)23
Yes
Balancemoney8
Yes
(0)
DocumentDatedatetime8
Yes
JournalDatedatetime8
Yes
PostedDatedatetime8
Yes
ItemCodeint4
Yes
CustNumbervarchar(15)15
Yes
Foreign Keys FK_StatementDocument_AccountingNote: [dbo].[AccountingNote].ANPriKeyIndexes IX_StatementDocument_ANPriKey: ANPriKeyANPriKeyint4
Yes
ApplyAmountmoney8
Yes
(0)
Adjustmentsmallint2
Yes
(0)
Foreign Keys FK_StatementDocument_BillingMinorItem: [dbo].[BillingMinorItem].BillingMinorPriKeyIndexes IX_StatementDocument_BillingMinorPriKey: BillingMinorPriKeyBillingMinorPriKeyint4
Yes
Foreign Keys FK_StatementDocument_OrderID: [dbo].[Orders].OrdPriKeyIndexes IX_StatementDocument_Order_DocNo: OrdPriKey\DocumentNumberOrdPriKeyint4
Yes
InvoiceNumbervarchar(30)30
Yes
Indexes IX_StatementDocument_ServiceCodePriKey: ServiceCodePriKeyServiceCodePriKeyint4
Yes
Foreign Keys FK_StatementDocument_StatementDetail: [dbo].[StatementDetail].StDetailPriKeyIndexes IX_StatementDocument: StDetailPriKeyStDetailPriKeyint4
Yes
Foreign Keys FK_StatementDocument_StatementDetailDist: [dbo].[StatementDetailDist].StDetailDistPriKeyIndexes IX_StatementDocument_1: StDetailDistPriKeyStDetailDistPriKeyint4
Yes
ApplyCheckint4
Yes
(0)
Foreign Keys FK_StatementDocument_BillingMinorDist: [dbo].[BillingMinorDist].BMinDistPriKeyIndexes IX_StatementDocument_BMinDistPriKey: BMinDistPriKeyBMinDistPriKeyint4
Yes
Foreign Keys FK_StatementDocument_AcctTransactions: [dbo].[AcctTransactions].ATPriKeyATPriKeyint4
Yes
GPSourcesmallint2
Yes
OriginalAmountmoney8
Yes
(0)
DistributionAdjustmentAmountmoney8
Yes
(0)
AdjustAmountmoney8
Yes
(0)
InvoiceDatedatetime8
Yes
CustomerNamevarchar(65)65
Yes
Foreign Keys FK_StatementDocument_Branch: [dbo].[Branch].BranchFIDIndexes IX_StatementDocument_BranchFID: BranchFIDBranchFIDint4
Yes
OtherApplyAmountmoney8
Yes
((0))
Indexes Indexes
NameColumnsUniqueFill Factor
Cluster Primary Key PK_StatementDocument: SDPriKeyPK_StatementDocumentSDPriKey
Yes
80
IX_StatementDocumentStDetailPriKey70
IX_StatementDocument_1StDetailDistPriKey70
IX_StatementDocument_ANPriKeyANPriKey
IX_StatementDocument_BillingMinorPriKeyBillingMinorPriKey70
IX_StatementDocument_BMinDistPriKeyBMinDistPriKey70
IX_StatementDocument_BranchFIDBranchFID
IX_StatementDocument_Order_DocNoOrdPriKey, DocumentNumber
IX_StatementDocument_ServiceCodePriKeyServiceCodePriKey70
Foreign Keys Foreign Keys
NameColumns
FK_StatementDocument_AccountingNoteANPriKey->[dbo].[AccountingNote].[ANPriKey]
FK_StatementDocument_AcctTransactionsATPriKey->[dbo].[AcctTransactions].[ATPriKey]
FK_StatementDocument_BillingMinorItemBillingMinorPriKey->[dbo].[BillingMinorItem].[BMinPriKey]
FK_StatementDocument_BillingMinorDistBMinDistPriKey->[dbo].[BillingMinorDist].[BMinDistPriKey]
FK_StatementDocument_BranchBranchFID->[dbo].[Branch].[BranchPriKey]
FK_StatementDocument_OrderIDOrdPriKey->[dbo].[Orders].[PriKey]
FK_StatementDocument_StatementDetailDistStDetailDistPriKey->[dbo].[StatementDetailDist].[SDDPriKey]
FK_StatementDocument_StatementDetailStDetailPriKey->[dbo].[StatementDetail].[SDPriKey]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[StatementDocument]
(
[SDPriKey] [int] NOT NULL IDENTITY(1, 1),
[DocumentNumber] [varchar] (23) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Balance] [money] NULL CONSTRAINT [DF_StatementDocument_Balance] DEFAULT (0),
[DocumentDate] [datetime] NULL,
[JournalDate] [datetime] NULL,
[PostedDate] [datetime] NULL,
[ItemCode] [int] NULL,
[CustNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ANPriKey] [int] NULL,
[ApplyAmount] [money] NULL CONSTRAINT [DF_StatementDocument_ApplyAmount] DEFAULT (0),
[Adjustment] [smallint] NULL CONSTRAINT [DF_StatementDocument_Adjustment] DEFAULT (0),
[BillingMinorPriKey] [int] NULL,
[OrdPriKey] [int] NULL,
[InvoiceNumber] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ServiceCodePriKey] [int] NULL,
[StDetailPriKey] [int] NULL,
[StDetailDistPriKey] [int] NULL,
[ApplyCheck] [int] NULL CONSTRAINT [DF_StatementDocument_ApplyCheck] DEFAULT (0),
[BMinDistPriKey] [int] NULL,
[ATPriKey] [int] NULL,
[GPSource] [smallint] NULL,
[OriginalAmount] [money] NULL CONSTRAINT [DF_StatementDocument_OriginalAmount] DEFAULT (0),
[DistributionAdjustmentAmount] [money] NULL CONSTRAINT [DF_StatementDocument_DistributionAdjustmentAmount] DEFAULT (0),
[AdjustAmount] [money] NULL CONSTRAINT [DF_StatementDocument_AdjustAmount] DEFAULT (0),
[InvoiceDate] [datetime] NULL,
[CustomerName] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BranchFID] [int] NULL,
[OtherApplyAmount] [money] NULL CONSTRAINT [DF_StatementDocument_OtherApplyAmount] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [PK_StatementDocument] PRIMARY KEY CLUSTERED  ([SDPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_ANPriKey] ON [dbo].[StatementDocument] ([ANPriKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_BillingMinorPriKey] ON [dbo].[StatementDocument] ([BillingMinorPriKey]) WITH (FILLFACTOR=70) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_BMinDistPriKey] ON [dbo].[StatementDocument] ([BMinDistPriKey]) WITH (FILLFACTOR=70) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_BranchFID] ON [dbo].[StatementDocument] ([BranchFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_Order_DocNo] ON [dbo].[StatementDocument] ([OrdPriKey], [DocumentNumber]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_ServiceCodePriKey] ON [dbo].[StatementDocument] ([ServiceCodePriKey]) WITH (FILLFACTOR=70) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument_1] ON [dbo].[StatementDocument] ([StDetailDistPriKey]) WITH (FILLFACTOR=70) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDocument] ON [dbo].[StatementDocument] ([StDetailPriKey]) WITH (FILLFACTOR=70) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_AccountingNote] FOREIGN KEY ([ANPriKey]) REFERENCES [dbo].[AccountingNote] ([ANPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_AcctTransactions] FOREIGN KEY ([ATPriKey]) REFERENCES [dbo].[AcctTransactions] ([ATPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_BillingMinorItem] FOREIGN KEY ([BillingMinorPriKey]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_BillingMinorDist] FOREIGN KEY ([BMinDistPriKey]) REFERENCES [dbo].[BillingMinorDist] ([BMinDistPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_Branch] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_OrderID] FOREIGN KEY ([OrdPriKey]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_StatementDetailDist] FOREIGN KEY ([StDetailDistPriKey]) REFERENCES [dbo].[StatementDetailDist] ([SDDPriKey])
GO
ALTER TABLE [dbo].[StatementDocument] ADD CONSTRAINT [FK_StatementDocument_StatementDetail] FOREIGN KEY ([StDetailPriKey]) REFERENCES [dbo].[StatementDetail] ([SDPriKey])
GO
GRANT SELECT ON  [dbo].[StatementDocument] TO [MssExec]
GRANT INSERT ON  [dbo].[StatementDocument] TO [MssExec]
GRANT DELETE ON  [dbo].[StatementDocument] TO [MssExec]
GRANT UPDATE ON  [dbo].[StatementDocument] TO [MssExec]
GO
Uses