[dbo].[BuildingConstraintItemMap]
CREATE TABLE [dbo].[BuildingConstraintItemMap]
(
[BuildingConstraintItemMapID] [int] NOT NULL IDENTITY(1, 1),
[BuildingFID] [int] NOT NULL,
[BuildingConstraintItemFID] [int] NOT NULL,
[ConstraintFlag] [bit] NOT NULL CONSTRAINT [DF_BuildingConstraint_ContraintFlag] DEFAULT ((0)),
[YesNoFlag] [bit] NOT NULL CONSTRAINT [DF_BuildingConstraintItemMap_AllowCheckbox] DEFAULT ((0)),
[Note] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BuildingConstraintItemMap] ADD CONSTRAINT [PK_BuildingConstraintItemMap] PRIMARY KEY CLUSTERED ([BuildingConstraintItemMapID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BuildingConstraintItemMap_BuildingsBuildingConstraintItemFID] ON [dbo].[BuildingConstraintItemMap] ([BuildingFID], [BuildingConstraintItemFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BuildingConstraintItemMap] ADD CONSTRAINT [FK_BuildingConstraintItemMap_Order] FOREIGN KEY ([BuildingConstraintItemFID]) REFERENCES [dbo].[BuildingConstraintItems] ([BuildingConstraintItemID])
GO
ALTER TABLE [dbo].[BuildingConstraintItemMap] ADD CONSTRAINT [FK_BuildingConstraintItemMap_OrderLocation] FOREIGN KEY ([BuildingFID]) REFERENCES [dbo].[Buildings] ([BuildingID])
GO
GRANT SELECT ON [dbo].[BuildingConstraintItemMap] TO [MssExec]
GRANT INSERT ON [dbo].[BuildingConstraintItemMap] TO [MssExec]
GRANT DELETE ON [dbo].[BuildingConstraintItemMap] TO [MssExec]
GRANT UPDATE ON [dbo].[BuildingConstraintItemMap] TO [MssExec]
GO