CREATE TABLE [dbo].[OrdCrates]
(
[OCPriKey] [int] NOT NULL IDENTITY(1, 1),
[OrdPriKey] [int] NOT NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Quantity] [int] NOT NULL,
[Height] [int] NOT NULL,
[Width] [int] NOT NULL,
[Length] [int] NOT NULL,
[CubicFeet] [float] NOT NULL,
[CrateItemCodeMapFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrdCrates] ADD CONSTRAINT [PK_OrdCrates] PRIMARY KEY CLUSTERED ([OCPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OrdCrates_CrateItemCodeMap] ON [dbo].[OrdCrates] ([CrateItemCodeMapFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OrdCrates_OrdPriKey] ON [dbo].[OrdCrates] ([OrdPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrdCrates] ADD CONSTRAINT [FK_OrdCrates_CrateItemCodeMap] FOREIGN KEY ([CrateItemCodeMapFID]) REFERENCES [dbo].[CrateItemCodeMap] ([CrateItemCodeMapID])
GO
ALTER TABLE [dbo].[OrdCrates] ADD CONSTRAINT [FK_OrdCrates_ORDERS] FOREIGN KEY ([OrdPriKey]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[OrdCrates] TO [MssExec]
GRANT INSERT ON [dbo].[OrdCrates] TO [MssExec]
GRANT DELETE ON [dbo].[OrdCrates] TO [MssExec]
GRANT UPDATE ON [dbo].[OrdCrates] TO [MssExec]
GO