CREATE TABLE [dbo].[XmlImportError]
(
[XmlImportErrorID] [int] NOT NULL IDENTITY(1, 1),
[DataDescription] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DateDownloaded] [datetime] NOT NULL,
[ErrorCodeFID] [int] NOT NULL,
[XmlID] [varchar] (111) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[XMLData] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[XmlSystemDataTypeMapFID] [int] NULL,
[OrderFID] [int] NULL,
[XmlImportHistoryFID] [int] NULL,
[IsVanLineOrderErrors] [bit] NOT NULL CONSTRAINT [DF_XmlImportError_IsVanLineOrderErrors] DEFAULT ((0))
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlImportError] ADD CONSTRAINT [PK_XmlImportError] PRIMARY KEY NONCLUSTERED ([XmlImportErrorID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_XmlImportError_Order_XmlSystem] ON [dbo].[XmlImportError] ([OrderFID], [XmlSystemDataTypeMapFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_XmlImportError_XmlID_XmlSystem] ON [dbo].[XmlImportError] ([XmlID], [XmlSystemDataTypeMapFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlImportError] ADD CONSTRAINT [FK_XmlImportError_ErrorCode] FOREIGN KEY ([ErrorCodeFID]) REFERENCES [dbo].[ErrorCode] ([ECPriKey])
GO
ALTER TABLE [dbo].[XmlImportError] ADD CONSTRAINT [FK_XmlImportError_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[XmlImportError] ADD CONSTRAINT [FK_XmlImportError_XmlImportHistory] FOREIGN KEY ([XmlImportHistoryFID]) REFERENCES [dbo].[XmlImportHistory] ([XmlImportHistoryID])
GO
ALTER TABLE [dbo].[XmlImportError] ADD CONSTRAINT [FK_XmlImportError_XmlSystemDataTypeMap] FOREIGN KEY ([XmlSystemDataTypeMapFID]) REFERENCES [dbo].[XmlSystemDataTypeMap] ([XmlSystemDataTypeMapID])
GO
GRANT SELECT ON [dbo].[XmlImportError] TO [MssExec]
GRANT INSERT ON [dbo].[XmlImportError] TO [MssExec]
GRANT DELETE ON [dbo].[XmlImportError] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlImportError] TO [MssExec]
GO