CREATE TABLE [dbo].[XmlLeadTypeMap]
(
[XmlLeadTypeMapID] [int] NOT NULL IDENTITY(1, 1),
[XmlInterfaceFID] [int] NOT NULL,
[LeadTypeFID] [int] NOT NULL,
[ExternalCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlLeadTypeMap] ADD CONSTRAINT [PK_XmlLeadTypeMap] PRIMARY KEY NONCLUSTERED ([XmlLeadTypeMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlLeadTypeMap] ADD CONSTRAINT [IX_XmlLeadTypeMap_ImlInterfaceFID_LeadTypeFID] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [LeadTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlLeadTypeMap] ADD CONSTRAINT [FK_XmlLeadTypeMap_LeadType] FOREIGN KEY ([LeadTypeFID]) REFERENCES [dbo].[LeadType] ([PriKey])
GO
ALTER TABLE [dbo].[XmlLeadTypeMap] ADD CONSTRAINT [FK_XmlLeadTypeMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID])
GO
GRANT SELECT ON [dbo].[XmlLeadTypeMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlLeadTypeMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlLeadTypeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlLeadTypeMap] TO [MssExec]
GO