[dbo].[XmlProductCodeVanlineMap]
CREATE TABLE [dbo].[XmlProductCodeVanlineMap]
(
[XmlProductCodeVanlineMapID] [int] NOT NULL IDENTITY(1, 1),
[ProductCodeFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalProductCodeCode] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlProductCodeVanlineMap] ADD CONSTRAINT [PK_XmlProductCodeVanlineMap] PRIMARY KEY NONCLUSTERED ([XmlProductCodeVanlineMapID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlProductCodeVanlineMap] ADD CONSTRAINT [IX_XmlProductCodeVanlineMap_XMLInterface_ExternalProductCodeCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalProductCodeCode]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlProductCodeVanlineMap] ADD CONSTRAINT [IX_XmlProductCodeVanlineMap_XMLInterface_ProductCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ProductCodeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlProductCodeVanlineMap] ADD CONSTRAINT [FK_XmlProductCodeVanlineMap_ProductCode] FOREIGN KEY ([ProductCodeFID]) REFERENCES [dbo].[ProductCode] ([ProductCodeID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlProductCodeVanlineMap] ADD CONSTRAINT [FK_XmlProductCodeVanlineMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlProductCodeVanlineMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlProductCodeVanlineMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlProductCodeVanlineMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlProductCodeVanlineMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'Description', N'Maps an external interface to a product Code.', 'SCHEMA', N'dbo', 'TABLE', N'XmlProductCodeVanlineMap', NULL, NULL
GO
EXEC sp_addextendedproperty N'Description', N'Code used by an external interface to represent a product Code.', 'SCHEMA', N'dbo', 'TABLE', N'XmlProductCodeVanlineMap', 'COLUMN', N'ExternalProductCodeCode'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to an external interface.', 'SCHEMA', N'dbo', 'TABLE', N'XmlProductCodeVanlineMap', 'COLUMN', N'XmlInterfaceFID'
GO