CREATE TABLE [dbo].[PMImportDetail]
(
[PMImportDetailID] [int] NOT NULL IDENTITY(1, 1),
[PMImportHeaderFID] [int] NOT NULL,
[OrderControl] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VendorID] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Amount] [money] NULL,
[Date] [datetime] NULL,
[OrderFID] [int] NULL,
[PaymentCodeFID] [int] NULL,
[SortBy] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DriverNo] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MergeablePayment] [bit] NOT NULL CONSTRAINT [DF_PMImportDetail_MergeablePayment] DEFAULT ((1)),
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PMImportDetail] ADD CONSTRAINT [PK_PMImportDetail] PRIMARY KEY CLUSTERED ([PMImportDetailID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_PMImportDetail_PMImportHeaderFID] ON [dbo].[PMImportDetail] ([PMImportHeaderFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PMImportDetail] ADD CONSTRAINT [FK_PMImportDetail_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[PMImportDetail] ADD CONSTRAINT [FK_PMImportDetail_PaymentCode] FOREIGN KEY ([PaymentCodeFID]) REFERENCES [dbo].[PaymentCode] ([PaymentCodePriKey])
GO
ALTER TABLE [dbo].[PMImportDetail] ADD CONSTRAINT [FK_PMImportDetail_PMImportHeader] FOREIGN KEY ([PMImportHeaderFID]) REFERENCES [dbo].[PMImportHeader] ([PMImportHeaderID])
GO
GRANT SELECT ON [dbo].[PMImportDetail] TO [MssExec]
GRANT INSERT ON [dbo].[PMImportDetail] TO [MssExec]
GRANT DELETE ON [dbo].[PMImportDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[PMImportDetail] TO [MssExec]
GO