[dbo].[XmlInterfaceCommodityDetailMap]
CREATE TABLE [dbo].[XmlInterfaceCommodityDetailMap]
(
[XmlInterfaceCommodityDetailMapID] [int] NOT NULL IDENTITY(1, 1),
[CommodityDetailFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommodityDetailMap] ADD CONSTRAINT [PK_XmlInterfaceCommodityDetailMap] PRIMARY KEY NONCLUSTERED ([XmlInterfaceCommodityDetailMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommodityDetailMap] ADD CONSTRAINT [IX_XmlInterfaceCommodityDetailMap_XMLInterface_CommodityDetail] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [CommodityDetailFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommodityDetailMap] ADD CONSTRAINT [IX_XmlInterfaceCommodityDetailMap_XMLInterface_ExternalCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommodityDetailMap] ADD CONSTRAINT [FK_XmlInterfaceCommodityDetailMap_CommodityDetail] FOREIGN KEY ([CommodityDetailFID]) REFERENCES [dbo].[CommodityDetail] ([CommodityDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlInterfaceCommodityDetailMap] ADD CONSTRAINT [FK_XmlInterfaceCommodityDetailMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlInterfaceCommodityDetailMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlInterfaceCommodityDetailMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlInterfaceCommodityDetailMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlInterfaceCommodityDetailMap] TO [MssExec]
GO