CREATE TABLE [dbo].[BATProcess]
(
[BATProcessPriKey] [int] NOT NULL IDENTITY(1, 1),
[BATSessionID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PostingDocNumber] [int] NULL,
[GLNumber] [varchar] (66) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[OpposingGLNumber] [varchar] (66) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocumentNumber] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[VoucherNumber] [varchar] (17) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ApplyToDocument] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TransactionType] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TransactionAmount] [money] NOT NULL,
[InvoicePayment] [money] NULL,
[InvoicePaymentAccount] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DocumentDate] [datetime] NOT NULL,
[JournalDate] [datetime] NOT NULL,
[AcctDBName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipperName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ItemDescription] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VendorNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PostingUserName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TransactionDate] [datetime] NULL,
[AccountingPostDate] [datetime] NULL,
[CustomerName] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VendorName] [varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PONumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VendorInvoiceNumber] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ICPriKey] [int] NULL,
[OrdPriKey] [int] NULL,
[BatchNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerNumber2] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OrderNo] [varchar] (23) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Authority] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NANumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Driver] [varchar] (43) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SalesPerson] [varchar] (43) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ItemCode] [int] NULL,
[Source] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SourceRecord] [int] NOT NULL,
[AcctNote] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BranchID] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InvoiceNumber] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InvoiceDate] [datetime] NULL,
[1099Flag] [bit] NOT NULL CONSTRAINT [DF_BATProcess_1099Flag] DEFAULT ((0)),
[OnHoldFlag] [bit] NULL,
[TempForeignID] [int] NULL,
[StatementHeaderID] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[BATProcess] ADD CONSTRAINT [PK_BATProcess] PRIMARY KEY CLUSTERED ([BATProcessPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BATProcess_DocumentNumber_BATSessionID] ON [dbo].[BATProcess] ([DocumentNumber], [BATSessionID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
GRANT SELECT ON [dbo].[BATProcess] TO [MssExec]
GRANT INSERT ON [dbo].[BATProcess] TO [MssExec]
GRANT DELETE ON [dbo].[BATProcess] TO [MssExec]
GRANT UPDATE ON [dbo].[BATProcess] TO [MssExec]
GO