[dbo].[XmlCodeOfServiceMap]
CREATE TABLE [dbo].[XmlCodeOfServiceMap]
(
[XmlCodeOfServiceMapID] [int] NOT NULL IDENTITY(1, 1),
[MilitaryCodeOfServiceFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlCodeOfServiceMap] ADD CONSTRAINT [PK_XmlCodeOfServiceMap] PRIMARY KEY NONCLUSTERED ([XmlCodeOfServiceMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlCodeOfServiceMap] ADD CONSTRAINT [IX_XmlCodeOfServiceMap_XMLInterface_ExternalCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlCodeOfServiceMap] ADD CONSTRAINT [IX_XmlCodeOfServiceMap_XMLInterface_MilitaryCodeOfService] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [MilitaryCodeOfServiceFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlCodeOfServiceMap] ADD CONSTRAINT [FK_XmlCodeOfServiceMap_MilitaryCodeOfService] FOREIGN KEY ([MilitaryCodeOfServiceFID]) REFERENCES [dbo].[MilitaryCodeOfService] ([MilitaryCodeOfServiceID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlCodeOfServiceMap] ADD CONSTRAINT [FK_XmlCodeOfServiceMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlCodeOfServiceMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlCodeOfServiceMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlCodeOfServiceMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlCodeOfServiceMap] TO [MssExec]
GO