CREATE TABLE [dbo].[ClaimItem]
(
[ClaimItemID] [int] NOT NULL IDENTITY(1, 1),
[ClaimFID] [int] NOT NULL,
[ClaimDenialCodeFID] [int] NULL,
[ClaimDamageTypeFID] [int] NOT NULL,
[ClaimAmount] [money] NOT NULL CONSTRAINT [DF_ClaimItem_ClaimAmount] DEFAULT ((0)),
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ExceptionsNoted] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ClaimItemStatusFID] [int] NULL,
[TagColor] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TagNumber] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [CK_ClaimItem_ClaimDamageType] CHECK (((1)=[dbo].[ClaimDamageTypeExistsForClaim]([ClaimDamageTypeFID],[ClaimFID])))
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [CK_ClaimItem_ClaimDenialCode] CHECK (((1)=[dbo].[ClaimDenialCodeExistsForClaim]([ClaimDenialCodeFID],[ClaimFID])))
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [PK_ClaimItem] PRIMARY KEY NONCLUSTERED ([ClaimItemID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ClaimItem_ClaimFID] ON [dbo].[ClaimItem] ([ClaimFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_ClaimItem_ClaimFID_Clustered] ON [dbo].[ClaimItem] ([ClaimFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [FK_ClaimItem_ClaimDamageType] FOREIGN KEY ([ClaimDamageTypeFID]) REFERENCES [dbo].[ClaimDamageType] ([ClaimDamageTypeID])
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [FK_ClaimItem_Claim] FOREIGN KEY ([ClaimFID]) REFERENCES [dbo].[Claim] ([ClaimID])
GO
ALTER TABLE [dbo].[ClaimItem] ADD CONSTRAINT [FK_ClaimItem_ClaimItemStatus] FOREIGN KEY ([ClaimItemStatusFID]) REFERENCES [dbo].[ClaimItemStatus] ([ClaimItemStatusID])
GO
GRANT SELECT ON [dbo].[ClaimItem] TO [MssExec]
GRANT INSERT ON [dbo].[ClaimItem] TO [MssExec]
GRANT DELETE ON [dbo].[ClaimItem] TO [MssExec]
GRANT UPDATE ON [dbo].[ClaimItem] TO [MssExec]
GO