[dbo].[XmlInterfaceCommTypeMap]
CREATE TABLE [dbo].[XmlInterfaceCommTypeMap]
(
[XmlInterfaceCommTypeMapID] [int] NOT NULL IDENTITY(1, 1),
[CommTypeFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalCommTypeCode] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommTypeMap] ADD CONSTRAINT [PK_XmlInterfaceCommTypeMap] PRIMARY KEY NONCLUSTERED ([XmlInterfaceCommTypeMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommTypeMap] ADD CONSTRAINT [IX_XmlInterfaceCommTypeMap_XMLInterface_CommType] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [CommTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommTypeMap] ADD CONSTRAINT [IX_XmlInterfaceCommTypeMap_XMLInterface_ExternalCommTypeCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalCommTypeCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceCommTypeMap] ADD CONSTRAINT [FK_XmlInterfaceCommTypeMap_CommType] FOREIGN KEY ([CommTypeFID]) REFERENCES [dbo].[CommType] ([PriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlInterfaceCommTypeMap] ADD CONSTRAINT [FK_XmlInterfaceCommTypeMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlInterfaceCommTypeMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlInterfaceCommTypeMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlInterfaceCommTypeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlInterfaceCommTypeMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'Description', N'Holds mappings an external interface to a commodity type.', 'SCHEMA', N'dbo', 'TABLE', N'XmlInterfaceCommTypeMap', NULL, NULL
GO
EXEC sp_addextendedproperty N'Description', N'Code used by an external interface to represent a commodity type.', 'SCHEMA', N'dbo', 'TABLE', N'XmlInterfaceCommTypeMap', 'COLUMN', N'ExternalCommTypeCode'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to an external interface.', 'SCHEMA', N'dbo', 'TABLE', N'XmlInterfaceCommTypeMap', 'COLUMN', N'XmlInterfaceFID'
GO