[dbo].[ErrorCodeStatistics]
CREATE TABLE [dbo].[ErrorCodeStatistics]
(
[ErrorCodeFID] [int] NOT NULL,
[LoggedCount] [int] NOT NULL CONSTRAINT [DF_LoggedCount] DEFAULT (1),
[StartDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ErrorCodeStatistics] ADD CONSTRAINT [IX_Unique_ErrorCodeID] UNIQUE NONCLUSTERED ([ErrorCodeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ErrorCodeStatistics] ADD CONSTRAINT [FK_ErrorCode] FOREIGN KEY ([ErrorCodeFID]) REFERENCES [dbo].[ErrorCode] ([ECPriKey])
GO
GRANT SELECT ON [dbo].[ErrorCodeStatistics] TO [MssExec]
GRANT INSERT ON [dbo].[ErrorCodeStatistics] TO [MssExec]
GRANT DELETE ON [dbo].[ErrorCodeStatistics] TO [MssExec]
GRANT UPDATE ON [dbo].[ErrorCodeStatistics] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to an error code.', 'SCHEMA', N'dbo', 'TABLE', N'ErrorCodeStatistics', 'COLUMN', N'ErrorCodeFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The number of times the error code was logged.', 'SCHEMA', N'dbo', 'TABLE', N'ErrorCodeStatistics', 'COLUMN', N'LoggedCount'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The date the error code was first logged.', 'SCHEMA', N'dbo', 'TABLE', N'ErrorCodeStatistics', 'COLUMN', N'StartDate'
GO