[dbo].[OrderLocationBuildingConstraint]
CREATE TABLE [dbo].[OrderLocationBuildingConstraint]
(
[OrderLocationBuildingConstraintID] [int] NOT NULL IDENTITY(1, 1),
[OrderLocationFID] [int] NOT NULL,
[BuildingConstraintItemFID] [int] NOT NULL,
[ConstraintFlag] [bit] NOT NULL CONSTRAINT [DF_OrderLocationBuildingConstraint_ContraintFlag] DEFAULT ((0)),
[Note] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderLocationBuildingConstraint] ADD CONSTRAINT [PK_OrderLocationBuildingConstraint] PRIMARY KEY CLUSTERED ([OrderLocationBuildingConstraintID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OrderLocationBuildingConstraintFID_OrderLocationBuildingConstraintItemFID] ON [dbo].[OrderLocationBuildingConstraint] ([OrderLocationFID], [BuildingConstraintItemFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderLocationBuildingConstraint] ADD CONSTRAINT [FK_OrderLocationBuildingConstraint_Order] FOREIGN KEY ([BuildingConstraintItemFID]) REFERENCES [dbo].[BuildingConstraintItems] ([BuildingConstraintItemID])
GO
ALTER TABLE [dbo].[OrderLocationBuildingConstraint] ADD CONSTRAINT [FK_OrderLocationBuildingConstraint_OrderLocation] FOREIGN KEY ([OrderLocationFID]) REFERENCES [dbo].[OrderLocations] ([OrderLocationID])
GO
GRANT SELECT ON [dbo].[OrderLocationBuildingConstraint] TO [MssExec]
GRANT INSERT ON [dbo].[OrderLocationBuildingConstraint] TO [MssExec]
GRANT DELETE ON [dbo].[OrderLocationBuildingConstraint] TO [MssExec]
GRANT UPDATE ON [dbo].[OrderLocationBuildingConstraint] TO [MssExec]
GO