CREATE TABLE [dbo].[AllocationDetail]
(
[ADPriKey] [int] NOT NULL IDENTITY(1, 1),
[AMPriKey] [int] NOT NULL,
[ICPriKey] [int] NULL,
[Percentage] [float] NOT NULL,
[Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AllocationDetail] ADD CONSTRAINT [CK_AllocationDetail_Percentage] CHECK (([Percentage]>(0)))
GO
ALTER TABLE [dbo].[AllocationDetail] ADD CONSTRAINT [PK_AllocationDetail] PRIMARY KEY CLUSTERED ([ADPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AllocationDetail] ADD CONSTRAINT [FK_AllocationDetail_AllocationMaster] FOREIGN KEY ([AMPriKey]) REFERENCES [dbo].[AllocationMaster] ([AMPriKey])
GO
ALTER TABLE [dbo].[AllocationDetail] ADD CONSTRAINT [FK_AllocationDetail_ItemCode] FOREIGN KEY ([ICPriKey]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
GRANT SELECT ON [dbo].[AllocationDetail] TO [MssExec]
GRANT INSERT ON [dbo].[AllocationDetail] TO [MssExec]
GRANT DELETE ON [dbo].[AllocationDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[AllocationDetail] TO [MssExec]
GO