CREATE TABLE [dbo].[RateMatrixRangeX]
(
[RateMatrixRangeXID] [int] NOT NULL IDENTITY(1, 1),
[RateMatrixFID] [int] NOT NULL,
[Minimum] [decimal] (12, 3) NOT NULL,
[Maximum] [decimal] (12, 3) NOT NULL,
[MinCharge] [float] NULL,
[MaxCharge] [float] NULL,
[Note] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RateMatrixRangeX] ADD CONSTRAINT [CK_RateMatrixRangeX_ValidRange] CHECK (((1)=[dbo].[RateMatrixRangeXValidRange]([RateMatrixFID],[Minimum],[Maximum])))
GO
ALTER TABLE [dbo].[RateMatrixRangeX] ADD CONSTRAINT [PK_RateMatrixRangeX] PRIMARY KEY CLUSTERED ([RateMatrixRangeXID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RateMatrixRangeX_RateMatrix] ON [dbo].[RateMatrixRangeX] ([RateMatrixFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RateMatrixRangeX] ADD CONSTRAINT [FK_RateMatrixRangeX_RateMatrix] FOREIGN KEY ([RateMatrixFID]) REFERENCES [dbo].[RateMatrix] ([RateMatrixID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[RateMatrixRangeX] TO [MssExec]
GRANT INSERT ON [dbo].[RateMatrixRangeX] TO [MssExec]
GRANT DELETE ON [dbo].[RateMatrixRangeX] TO [MssExec]
GRANT UPDATE ON [dbo].[RateMatrixRangeX] TO [MssExec]
GO