[dbo].[XmlInterfaceAccountMap]
CREATE TABLE [dbo].[XmlInterfaceAccountMap]
(
[XmlInterfaceAccountMapId] [int] NOT NULL IDENTITY(1, 1),
[XmlInterfaceFid] [int] NOT NULL,
[AccountFid] [int] NOT NULL,
[ExternalCode] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceAccountMap] ADD CONSTRAINT [PK_XmlInterfaceAccountMap] PRIMARY KEY NONCLUSTERED ([XmlInterfaceAccountMapId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceAccountMap] ADD CONSTRAINT [IX_XmlInterfaceAccountMap_XmlInterface_Account] UNIQUE NONCLUSTERED ([XmlInterfaceFid], [AccountFid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceAccountMap] ADD CONSTRAINT [IX_XmlInterfaceAccountMap_XmlInterface_ExternalCode] UNIQUE NONCLUSTERED ([XmlInterfaceFid], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlInterfaceAccountMap] ADD CONSTRAINT [FK_XmlInterfaceAccountMap_Account] FOREIGN KEY ([AccountFid]) REFERENCES [dbo].[Accounts] ([AccountPriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlInterfaceAccountMap] ADD CONSTRAINT [FK_XmlInterfaceAccountMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFid]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlInterfaceAccountMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlInterfaceAccountMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlInterfaceAccountMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlInterfaceAccountMap] TO [MssExec]
GO