CREATE TABLE [dbo].[ItemCode]
(
[ICPriKey] [int] NOT NULL IDENTITY(1, 1),
[ItemCode] [int] NOT NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DiscountGroup] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[QuantityOnHand] [int] NULL,
[Cost] [money] NULL,
[RGPriKey] [int] NULL,
[Invoice] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InvoiceOrder] [int] NULL,
[IGPriKey] [int] NULL,
[AvgRevenue] [money] NULL,
[CPUItem] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ServiceCodePriKey] [int] NULL,
[GLGroup] [int] NULL,
[PreferredRevenueAgentFID] [int] NULL,
[PointOfServiceFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [PK_ItemCode] PRIMARY KEY NONCLUSTERED ([ICPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [IX_ItemCode] UNIQUE CLUSTERED ([ItemCode]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [FK_ItemCode_InvoiceGroup] FOREIGN KEY ([IGPriKey]) REFERENCES [dbo].[InvoiceGroup] ([IGPriKey])
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [FK_ItemCode_PointOfService] FOREIGN KEY ([PointOfServiceFID]) REFERENCES [dbo].[PointOfService] ([PointOfServiceID])
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [FK_ItemCode_PreferredRevenueAgent] FOREIGN KEY ([PreferredRevenueAgentFID]) REFERENCES [dbo].[PreferredRevenueAgent] ([PreferredRevenueAgentID])
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [FK_ItemCode_RevGroups] FOREIGN KEY ([RGPriKey]) REFERENCES [dbo].[RevGroups] ([RGPriKey])
GO
ALTER TABLE [dbo].[ItemCode] ADD CONSTRAINT [FK_ItemCode_ServiceCode] FOREIGN KEY ([ServiceCodePriKey]) REFERENCES [dbo].[ServiceCode] ([ServiceCodePriKey])
GO
GRANT SELECT ON [dbo].[ItemCode] TO [MssExec]
GRANT INSERT ON [dbo].[ItemCode] TO [MssExec]
GRANT DELETE ON [dbo].[ItemCode] TO [MssExec]
GRANT UPDATE ON [dbo].[ItemCode] TO [MssExec]
GO