Tables [dbo].[Claim]
Properties
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
HeapYes
Row Count (~)293
Created10:12:52 PM Thursday, December 28, 2006
Last Modified9:01:14 AM Friday, November 22, 2024
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentityDefault
Primary Key PK_Claim: ClaimIDClaimIDint4
No
1 - 1
Foreign Keys FK_Claim_Orders: [dbo].[Orders].OrdersFIDIndexes IX_Claim_OrderID_ClaimNumber: OrdersFID\ClaimNumberOrdersFIDint4
No
Foreign Keys FK_Claim_ClaimType: [dbo].[ClaimType].ClaimTypeFIDClaimTypeFIDint4
No
Foreign Keys FK_Claim_ClaimStatus: [dbo].[ClaimStatus].ClaimStatusFIDClaimStatusFIDint4
No
Indexes IX_Claim_OrderID_ClaimNumber: OrdersFID\ClaimNumberClaimNumbervarchar(64)64
No
MultiLossAlertNumbervarchar(64)64
Yes
CreatedDatedatetime8
No
(getdate())
Foreign Keys FK_Claim_CreatedBySysUser: [dbo].[Sysuser].CreatedBySysUserFIDIndexes IX_Claim_CreatedBySysUserFID: CreatedBySysUserFIDCreatedBySysUserFIDint4
No
ClosedDatedatetime8
Yes
ForwardTovarchar(128)128
Yes
ForwardDatedatetime8
Yes
TotalAmountmoney8
No
((0))
Foreign Keys FK_Claim_AdjusterSysUser: [dbo].[Sysuser].AdjusterSysUserFIDIndexes IX_Claim_AdjusterSysUserFID: AdjusterSysUserFIDAdjusterSysUserFIDint4
Yes
Foreign Keys FK_Claim_ClaimInsuranceProvider: [dbo].[ClaimInsuranceProvider].ClaimInsuranceProviderFIDClaimInsuranceProviderFIDint4
Yes
InsuranceDeductiblemoney8
No
((0))
NoFaultbit1
No
((0))
Foreign Keys FK_Claim_Profiles: [dbo].[Profiles].ProfilesFIDProfilesFIDint4
Yes
Foreign Keys FK_Claim_RollOuts: [dbo].[RollOuts].RollOutsFIDRollOutsFIDint4
Yes
Foreign Keys FK_Claim_Branch: [dbo].[Branch].BranchFIDBranchFIDint4
No
Foreign Keys FK_Claim_Division: [dbo].[Division].DivisionFIDDivisionFIDint4
Yes
ClaimFormSentDatedatetime8
Yes
ActualClaimReceivedDatedatetime8
Yes
ActualClosedToCustomerDatedatetime8
Yes
Indexes Indexes
NameColumnsUniqueFill Factor
Primary Key PK_Claim: ClaimIDPK_ClaimClaimID
Yes
80
IX_Claim_AdjusterSysUserFIDAdjusterSysUserFID
IX_Claim_CreatedBySysUserFIDCreatedBySysUserFID
IX_Claim_OrderID_ClaimNumberOrdersFID, ClaimNumber
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
ClaimTaskFieldChanged
Yes
Yes
After Update
Foreign Keys Foreign Keys
NameColumns
FK_Claim_AdjusterSysUserAdjusterSysUserFID->[dbo].[Sysuser].[SysUserID]
FK_Claim_BranchBranchFID->[dbo].[Branch].[BranchPriKey]
FK_Claim_ClaimInsuranceProviderClaimInsuranceProviderFID->[dbo].[ClaimInsuranceProvider].[ClaimInsuranceProviderID]
FK_Claim_ClaimStatusClaimStatusFID->[dbo].[ClaimStatus].[ClaimStatusID]
FK_Claim_ClaimTypeClaimTypeFID->[dbo].[ClaimType].[ClaimTypeID]
FK_Claim_CreatedBySysUserCreatedBySysUserFID->[dbo].[Sysuser].[SysUserID]
FK_Claim_DivisionDivisionFID->[dbo].[Division].[DivisionID]
FK_Claim_OrdersOrdersFID->[dbo].[Orders].[PriKey]
FK_Claim_ProfilesProfilesFID->[dbo].[Profiles].[ProfileID]
FK_Claim_RollOutsRollOutsFID->[dbo].[RollOuts].[RollOutID]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[Claim]
(
[ClaimID] [int] NOT NULL IDENTITY(1, 1),
[OrdersFID] [int] NOT NULL,
[ClaimTypeFID] [int] NOT NULL,
[ClaimStatusFID] [int] NOT NULL,
[ClaimNumber] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MultiLossAlertNumber] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreatedDate] [datetime] NOT NULL CONSTRAINT [DF_Claim_CreatedDate] DEFAULT (getdate()),
[CreatedBySysUserFID] [int] NOT NULL,
[ClosedDate] [datetime] NULL,
[ForwardTo] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ForwardDate] [datetime] NULL,
[TotalAmount] [money] NOT NULL CONSTRAINT [DF_Claim_TotalAmount] DEFAULT ((0)),
[AdjusterSysUserFID] [int] NULL,
[ClaimInsuranceProviderFID] [int] NULL,
[InsuranceDeductible] [money] NOT NULL CONSTRAINT [DF_Claim_InsuranceDeductible] DEFAULT ((0)),
[NoFault] [bit] NOT NULL CONSTRAINT [DF_Claim_NoFault] DEFAULT ((0)),
[ProfilesFID] [int] NULL,
[RollOutsFID] [int] NULL,
[BranchFID] [int] NOT NULL,
[DivisionFID] [int] NULL,
[ClaimFormSentDate] [datetime] NULL,
[ActualClaimReceivedDate] [datetime] NULL,
[ActualClosedToCustomerDate] [datetime] NULL
) ON [PRIMARY]
GO

CREATE trigger [dbo].[ClaimTaskFieldChanged] on [dbo].[Claim]
after update
as
set nocount on
    if( update( CreatedDate ) or update( ClosedDate ) or update( ClaimFormSentDate ) or update( ActualClaimReceivedDate ) or update( ActualClosedToCustomerDate ) )
    begin
        update ToDo set ToDo.DueDate =
            case DependencyDate.FieldName
                when 'CreatedDate' then dbo.udfTaskDueDate( ToDo.DueType, ToDo.DueDays, inserted.CreatedDate )
                when 'ClosedDate' then dbo.udfTaskDueDate( ToDo.DueType, ToDo.DueDays, inserted.ClosedDate )
                when 'ClaimFormSentDate' then dbo.udfTaskDueDate( ToDo.DueType, ToDo.DueDays, inserted.ClaimFormSentDate )
                when 'ActualClaimReceivedDate' then dbo.udfTaskDueDate( ToDo.DueType, ToDo.DueDays, inserted.ActualClaimReceivedDate )
                when 'ActualClosedToCustomerDate' then dbo.udfTaskDueDate( ToDo.DueType, ToDo.DueDays, inserted.ActualClosedToCustomerDate )
                else ToDo.DueDate
            end
        from ToDo
        inner join inserted on inserted.OrdersFID = ToDo.OrderID and inserted.ClaimNumber = ToDo.Identifier
        inner join DependencyDate on ToDo.DependencyDateID = DependencyDate.DependencyDateID
        where DependencyDate.TableName = 'Claim'
    end
    if( update( AdjusterSysUserFID ) )
    begin
        update ToDo set TaskUserFID =
            case CoordinatorType.FieldName
                when 'AdjusterSysUserFID' then inserted.AdjusterSysUserFID
            end
        from ToDo
        inner join inserted on inserted.OrdersFID = ToDo.OrderID and inserted.ClaimNumber = ToDo.Identifier
        inner join CoordinatorType on ToDo.CoordinatorTypeFID = CoordinatorType.CoordinatorTypeID
        where CoordinatorType.TableName = 'Claim'
    end
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [PK_Claim] PRIMARY KEY NONCLUSTERED  ([ClaimID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Claim_AdjusterSysUserFID] ON [dbo].[Claim] ([AdjusterSysUserFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Claim_CreatedBySysUserFID] ON [dbo].[Claim] ([CreatedBySysUserFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Claim_OrderID_ClaimNumber] ON [dbo].[Claim] ([OrdersFID], [ClaimNumber]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_AdjusterSysUser] FOREIGN KEY ([AdjusterSysUserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_Branch] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_ClaimInsuranceProvider] FOREIGN KEY ([ClaimInsuranceProviderFID]) REFERENCES [dbo].[ClaimInsuranceProvider] ([ClaimInsuranceProviderID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_ClaimStatus] FOREIGN KEY ([ClaimStatusFID]) REFERENCES [dbo].[ClaimStatus] ([ClaimStatusID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_ClaimType] FOREIGN KEY ([ClaimTypeFID]) REFERENCES [dbo].[ClaimType] ([ClaimTypeID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_CreatedBySysUser] FOREIGN KEY ([CreatedBySysUserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_Division] FOREIGN KEY ([DivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_Orders] FOREIGN KEY ([OrdersFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_Profiles] FOREIGN KEY ([ProfilesFID]) REFERENCES [dbo].[Profiles] ([ProfileID])
GO
ALTER TABLE [dbo].[Claim] ADD CONSTRAINT [FK_Claim_RollOuts] FOREIGN KEY ([RollOutsFID]) REFERENCES [dbo].[RollOuts] ([RollOutID])
GO
GRANT SELECT ON  [dbo].[Claim] TO [MssExec]
GRANT INSERT ON  [dbo].[Claim] TO [MssExec]
GRANT DELETE ON  [dbo].[Claim] TO [MssExec]
GRANT UPDATE ON  [dbo].[Claim] TO [MssExec]
GO
Uses
Used By