CREATE TABLE [dbo].[OperationalPlan]
(
[OperationalPlanID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[PlanName] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Note] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OperationalPlan] ADD CONSTRAINT [PK_OperationalPlan] PRIMARY KEY CLUSTERED ([OperationalPlanID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_OperationalPlan_OrderFID_PlanName] ON [dbo].[OperationalPlan] ([OrderFID], [PlanName]) INCLUDE ([OperationalPlanID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OperationalPlan] ADD CONSTRAINT [FK_OperationalPlan_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[OperationalPlan] TO [MssExec]
GRANT INSERT ON [dbo].[OperationalPlan] TO [MssExec]
GRANT DELETE ON [dbo].[OperationalPlan] TO [MssExec]
GRANT UPDATE ON [dbo].[OperationalPlan] TO [MssExec]
GO