[dbo].[XmlXtraStopDeletedMap]
CREATE TABLE [dbo].[XmlXtraStopDeletedMap]
(
[XmlXtraStopDeletedMapID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[XmlSystemFID] [int] NOT NULL,
[ExternalStopNumber] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ExternalTripNumber] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ExternalMoveNumber] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SentToVanline] [bit] NOT NULL CONSTRAINT [DF_XmlXtraStopDeletedMap_SentToVanline] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlXtraStopDeletedMap] ADD CONSTRAINT [PK_XmlXtraStopDeletedMap] PRIMARY KEY CLUSTERED ([XmlXtraStopDeletedMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlXtraStopDeletedMap] ADD CONSTRAINT [IX_XmlXtraStopDeletedMap_XmlSystem_ExternalStopNumber] UNIQUE NONCLUSTERED ([OrderFID], [ExternalStopNumber], [XmlSystemFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlXtraStopDeletedMap] ADD CONSTRAINT [FK_XmlXtraStopDeletedMap_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlXtraStopDeletedMap] ADD CONSTRAINT [FK_XmlXtraStopDeletedMap_XmlSystem] FOREIGN KEY ([XmlSystemFID]) REFERENCES [dbo].[XmlSystem] ([XmlSystemID])
GO
GRANT SELECT ON [dbo].[XmlXtraStopDeletedMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlXtraStopDeletedMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlXtraStopDeletedMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlXtraStopDeletedMap] TO [MssExec]
GO