CREATE TABLE [dbo].[OrdersExtended]
(
[OrdersExtendedID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[CommodityDetailFID] [int] NULL,
[HaulModeFID] [int] NULL,
[WillAdvise] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CodCollectionAmount] [money] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrdersExtended] ADD CONSTRAINT [PK_OrdersExtended] PRIMARY KEY CLUSTERED ([OrdersExtendedID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrdersExtended] ADD CONSTRAINT [IX_OrdersExtended_Order] UNIQUE NONCLUSTERED ([OrderFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrdersExtended] ADD CONSTRAINT [FK_OrdersExtended_CommodityDetail] FOREIGN KEY ([CommodityDetailFID]) REFERENCES [dbo].[CommodityDetail] ([CommodityDetailID])
GO
ALTER TABLE [dbo].[OrdersExtended] ADD CONSTRAINT [FK_OrdersExtended_HaulMode] FOREIGN KEY ([HaulModeFID]) REFERENCES [dbo].[HaulMode] ([HaulModeID])
GO
ALTER TABLE [dbo].[OrdersExtended] ADD CONSTRAINT [FK_OrdersExtended_Order] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[OrdersExtended] TO [MssExec]
GRANT INSERT ON [dbo].[OrdersExtended] TO [MssExec]
GRANT DELETE ON [dbo].[OrdersExtended] TO [MssExec]
GRANT UPDATE ON [dbo].[OrdersExtended] TO [MssExec]
GO