[dbo].[XmlDocInterfaceMap]
CREATE TABLE [dbo].[XmlDocInterfaceMap]
(
[XmlDocInterfaceMapID] [int] NOT NULL IDENTITY(1, 1),
[DocumentTypeFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalDocumentTypeCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlDocInterfaceMap] ADD CONSTRAINT [PK_XmlDocInterfaceMap] PRIMARY KEY NONCLUSTERED ([XmlDocInterfaceMapID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlDocInterfaceMap] ADD CONSTRAINT [IX_XmlDocInterfaceMap_XMLInterface_DocumentType] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [DocumentTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_XmlDocInterfaceMap_XmlInterface_ExternalCode_ID] ON [dbo].[XmlDocInterfaceMap] ([XmlInterfaceFID], [ExternalDocumentTypeCode], [XmlDocInterfaceMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlDocInterfaceMap] ADD CONSTRAINT [FK_XmlDocInterfaceMap_DocumentType] FOREIGN KEY ([DocumentTypeFID]) REFERENCES [dbo].[DocumentType] ([DocumentTypeID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlDocInterfaceMap] ADD CONSTRAINT [FK_XmlDocInterfaceMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlDocInterfaceMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlDocInterfaceMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlDocInterfaceMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlDocInterfaceMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'Description', N'Maps an external interface to a document type.', 'SCHEMA', N'dbo', 'TABLE', N'XmlDocInterfaceMap', NULL, NULL
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to a document type.', 'SCHEMA', N'dbo', 'TABLE', N'XmlDocInterfaceMap', 'COLUMN', N'DocumentTypeFID'
GO
EXEC sp_addextendedproperty N'Description', N'Code used by an external interface to represent a document type.', 'SCHEMA', N'dbo', 'TABLE', N'XmlDocInterfaceMap', 'COLUMN', N'ExternalDocumentTypeCode'
GO
EXEC sp_addextendedproperty N'Description', N'The primary key.', 'SCHEMA', N'dbo', 'TABLE', N'XmlDocInterfaceMap', 'COLUMN', N'XmlDocInterfaceMapID'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to an external interface.', 'SCHEMA', N'dbo', 'TABLE', N'XmlDocInterfaceMap', 'COLUMN', N'XmlInterfaceFID'
GO