CREATE TABLE [dbo].[GPWarehouse]
(
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[OrderID] [int] NULL,
[Authority] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OrderNumber] [varchar] (23) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Salesperson] [varchar] (44) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Shipper] [varchar] (44) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OrderOriginAddress] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OrderDestinationAddress] [varchar] (30) 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,
[InvoiceAmount] [money] NULL,
[InvoiceAge] [int] NULL,
[InvoiceCreatedDate] [datetime] NULL,
[InvoiceCreatedBy] [varchar] (44) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InvoicedHeaderID] [int] NULL,
[DocumentNumber] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocumentDescription] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DocumentDate] [datetime] NULL,
[DueDate] [datetime] NULL,
[PostDate] [datetime] NULL,
[JournalDate] [datetime] NULL,
[DocumentType] [smallint] NOT NULL,
[OriginalTransactionAmount] [money] NULL,
[CurrentTransactionAmount] [money] NULL,
[DocumentAge] [int] NULL,
[ItemCode] [int] NULL,
[BranchFID] [int] NULL,
[PONumber] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GBLNumber] [varchar] (21) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IsFactored] [bit] NOT NULL CONSTRAINT [DF_GPWarehouse_IsFactored] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GPWarehouse] ADD CONSTRAINT [PK_GPWarehouse] PRIMARY KEY NONCLUSTERED ([CustomerNumber], [DocumentType], [DocumentNumber]) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_GPWarehouse_CustomerNumber] ON [dbo].[GPWarehouse] ([CustomerNumber]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_GPWarehouse_OrderID] ON [dbo].[GPWarehouse] ([OrderID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_GPWarehouse_OrderNumber] ON [dbo].[GPWarehouse] ([OrderNumber]) ON [PRIMARY]
GO
GRANT SELECT ON [dbo].[GPWarehouse] TO [MssExec]
GRANT INSERT ON [dbo].[GPWarehouse] TO [MssExec]
GRANT DELETE ON [dbo].[GPWarehouse] TO [MssExec]
GRANT UPDATE ON [dbo].[GPWarehouse] TO [MssExec]
GO