CREATE TABLE [dbo].[StorageErrorLog]
(
[PriKey] [int] NOT NULL IDENTITY(1, 1),
[SessionID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[OrdPriKey] [int] NULL,
[ECPriKey] [int] NOT NULL,
[Param1] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Param2] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Param3] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Param4] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Param5] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageErrorLog] ADD CONSTRAINT [PK_StorageErrorLog] PRIMARY KEY NONCLUSTERED ([PriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageErrorLog_SessionID] ON [dbo].[StorageErrorLog] ([SessionID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageErrorLog] ADD CONSTRAINT [FK_StorageErrorLog_ErrorCode] FOREIGN KEY ([ECPriKey]) REFERENCES [dbo].[ErrorCode] ([ECPriKey])
GO
ALTER TABLE [dbo].[StorageErrorLog] ADD CONSTRAINT [FK_StorageErrorLog_Orders] FOREIGN KEY ([OrdPriKey]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[StorageErrorLog] TO [MssExec]
GRANT INSERT ON [dbo].[StorageErrorLog] TO [MssExec]
GRANT DELETE ON [dbo].[StorageErrorLog] TO [MssExec]
GRANT UPDATE ON [dbo].[StorageErrorLog] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to an error code.', 'SCHEMA', N'dbo', 'TABLE', N'StorageErrorLog', 'COLUMN', N'ECPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key an order.', 'SCHEMA', N'dbo', 'TABLE', N'StorageErrorLog', 'COLUMN', N'OrdPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key.', 'SCHEMA', N'dbo', 'TABLE', N'StorageErrorLog', 'COLUMN', N'PriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Storage session the error occurred. ', 'SCHEMA', N'dbo', 'TABLE', N'StorageErrorLog', 'COLUMN', N'SessionID'
GO