CREATE TABLE [dbo].[XmlAutoClassMap]
(
[XmlAutoClassMapID] [int] NOT NULL IDENTITY(1, 1),
[XmlInterfaceFID] [int] NOT NULL,
[AutoClassFID] [int] NOT NULL,
[ExternalCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlAutoClassMap] ADD CONSTRAINT [PK_XmlAutoClassMap] PRIMARY KEY NONCLUSTERED ([XmlAutoClassMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlAutoClassMap] ADD CONSTRAINT [IX_XmlAutoClassMap_AutoClass_XMLInterface_ExternalCode] UNIQUE CLUSTERED ([AutoClassFID], [XmlInterfaceFID], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlAutoClassMap] ADD CONSTRAINT [IX_XmlAutoClassMap_XMLInterface_ExternalCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlAutoClassMap] ADD CONSTRAINT [FK_XmlAutoClassMap_AutoClass] FOREIGN KEY ([AutoClassFID]) REFERENCES [dbo].[AutoClass] ([AutoClassID])
GO
ALTER TABLE [dbo].[XmlAutoClassMap] ADD CONSTRAINT [FK_XmlAutoClassMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID])
GO
GRANT SELECT ON [dbo].[XmlAutoClassMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlAutoClassMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlAutoClassMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlAutoClassMap] TO [MssExec]
GO