CREATE TABLE [dbo].[LSMaterial]
(
[LSMPriKey] [int] NOT NULL IDENTITY(1, 1),
[LocServPriKey] [int] NOT NULL,
[ActQuantity] [int] NULL,
[MaterialItemCodeMapFID] [int] NULL,
[EstQuantity] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[LSMaterial] ADD CONSTRAINT [PK_LSMaterial] PRIMARY KEY CLUSTERED ([LSMPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_LSMaterial_LocServPriKey] ON [dbo].[LSMaterial] ([LocServPriKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_LSMaterial_MaterialItemCodeMap] ON [dbo].[LSMaterial] ([MaterialItemCodeMapFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[LSMaterial] ADD CONSTRAINT [FK_LSMaterial_LOCSERV] FOREIGN KEY ([LocServPriKey]) REFERENCES [dbo].[LocServ] ([PriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[LSMaterial] ADD CONSTRAINT [FK_LSMaterial_MaterialItemCodeMap] FOREIGN KEY ([MaterialItemCodeMapFID]) REFERENCES [dbo].[MaterialItemCodeMap] ([MaterialItemCodeMapID])
GO
GRANT SELECT ON [dbo].[LSMaterial] TO [MssExec]
GRANT INSERT ON [dbo].[LSMaterial] TO [MssExec]
GRANT DELETE ON [dbo].[LSMaterial] TO [MssExec]
GRANT UPDATE ON [dbo].[LSMaterial] TO [MssExec]
GO