[dbo].[XmlValuationVanLineCodeMap]
CREATE TABLE [dbo].[XmlValuationVanLineCodeMap]
(
[XmlValuationVanLineCodeMapID] [int] NOT NULL IDENTITY(1, 1),
[ValuationFID] [int] NOT NULL,
[XmlInterfaceFID] [int] NOT NULL,
[VanLineCode] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlValuationVanLineCodeMap] ADD CONSTRAINT [PK_XmlValuationVanLineCodeMap] PRIMARY KEY CLUSTERED ([XmlValuationVanLineCodeMapID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlValuationVanLineCodeMap] ADD CONSTRAINT [IX_UniqueValuation_Valuation_Interface] UNIQUE NONCLUSTERED ([ValuationFID], [XmlInterfaceFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlValuationVanLineCodeMap] ADD CONSTRAINT [IX_UniqueValuation_Interface_VanLineCode] UNIQUE NONCLUSTERED ([XmlInterfaceFID], [VanLineCode]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[XmlValuationVanLineCodeMap] ADD CONSTRAINT [FK_XmlValuationVanLineCodeMap_Valuation] FOREIGN KEY ([ValuationFID]) REFERENCES [dbo].[Valuation] ([ValuationID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[XmlValuationVanLineCodeMap] ADD CONSTRAINT [FK_XmlValuationVanLineCodeMap_XmlInterface] FOREIGN KEY ([XmlInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[XmlValuationVanLineCodeMap] TO [MssExec]
GRANT INSERT ON [dbo].[XmlValuationVanLineCodeMap] TO [MssExec]
GRANT DELETE ON [dbo].[XmlValuationVanLineCodeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[XmlValuationVanLineCodeMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to a valuation.', 'SCHEMA', N'dbo', 'TABLE', N'XmlValuationVanLineCodeMap', 'COLUMN', N'ValuationFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The van line code for the Valuation and XMLInterface.', 'SCHEMA', N'dbo', 'TABLE', N'XmlValuationVanLineCodeMap', 'COLUMN', N'VanLineCode'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The primary key.', 'SCHEMA', N'dbo', 'TABLE', N'XmlValuationVanLineCodeMap', 'COLUMN', N'XmlValuationVanLineCodeMapID'
GO