[dbo].[XmlPaymentCodeMap]
CREATE TABLE [dbo].[XmlPaymentCodeMap]
(
[XmlPaymentCodeMapID] [int] NOT NULL IDENTITY(1, 1),
[XmlInterfaceFID] [int] NOT NULL,
[PaymentCodeFID] [int] NOT NULL,
[ExternalPaymentCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AlwaysAttachDriver] [bit] NOT NULL CONSTRAINT [DF_XmlPaymentCodeMap_AlwaysAttachDriver] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlPaymentCodeMap] ADD CONSTRAINT [PK_XmlPaymentCodeMap] PRIMARY KEY CLUSTERED ([XmlPaymentCodeMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlPaymentCodeMap] ADD CONSTRAINT [IX_XmlPaymentCodeMap_XMLInterface_ExternalPaymentCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalPaymentCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlPaymentCodeMap] ADD CONSTRAINT [FK_XmlPaymentCodeMap_PaymentCode] FOREIGN KEY ([PaymentCodeFID]) REFERENCES [dbo].[PaymentCode] ([PaymentCodePriKey])
GO
ALTER TABLE [dbo].[XmlPaymentCodeMap] ADD CONSTRAINT [FK_XmlPaymentCodeMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID])
GO
GRANT SELECT ON [dbo].[XmlPaymentCodeMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlPaymentCodeMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlPaymentCodeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlPaymentCodeMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'Description', N'Code used by an external interface to represent a payment code.', 'SCHEMA', N'dbo', 'TABLE', N'XmlPaymentCodeMap', 'COLUMN', N'ExternalPaymentCode'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to our payment code.', 'SCHEMA', N'dbo', 'TABLE', N'XmlPaymentCodeMap', 'COLUMN', N'PaymentCodeFID'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to an external interface.', 'SCHEMA', N'dbo', 'TABLE', N'XmlPaymentCodeMap', 'COLUMN', N'XmlInterfaceFID'
GO
EXEC sp_addextendedproperty N'Description', N'The primary key.', 'SCHEMA', N'dbo', 'TABLE', N'XmlPaymentCodeMap', 'COLUMN', N'XmlPaymentCodeMapID'
GO