[dbo].[OrderNoteDetailExternalMap]
CREATE TABLE [dbo].[OrderNoteDetailExternalMap]
(
[OrderNoteDetailExternalMapID] [int] NOT NULL IDENTITY(1, 1),
[OrderNoteDetailFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[ExternalID] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderNoteDetailExternalMap] ADD CONSTRAINT [PK_OrderNoteDetailExternalMap] PRIMARY KEY CLUSTERED ([OrderNoteDetailExternalMapID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OrderNoteDetailExternalMap_OrderNoteDetailFID] ON [dbo].[OrderNoteDetailExternalMap] ([OrderNoteDetailFID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_OrderNoteDetailExternalMap_XmlInterfaceFIDExternalID] ON [dbo].[OrderNoteDetailExternalMap] ([XmlInterfaceFID], [ExternalID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderNoteDetailExternalMap] ADD CONSTRAINT [FK_OrderNoteDetailExternalMap_OrderNoteDetail] FOREIGN KEY ([OrderNoteDetailFID]) REFERENCES [dbo].[OrderNoteDetail] ([OrderNoteDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OrderNoteDetailExternalMap] ADD CONSTRAINT [FK_OrderNoteDetailExternalMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID])
GO
GRANT SELECT ON [dbo].[OrderNoteDetailExternalMap] TO [MssExec]
GRANT INSERT ON [dbo].[OrderNoteDetailExternalMap] TO [MssExec]
GRANT DELETE ON [dbo].[OrderNoteDetailExternalMap] TO [MssExec]
GRANT UPDATE ON [dbo].[OrderNoteDetailExternalMap] TO [MssExec]
GO