我需要從一組csv文件中讀取行並將其寫入數據庫中的現有表中。然而,爲了做到這一點,我需要將平面文件數據與我數據庫中的表中的兩個選定值相結合。我在SSIS中構建了一個應該允許使用Lookup轉換的設計。但是,它不工作:(將OLE DB查找與平面文件結合起來SSIS
這裏是我的設計:
當我調試我得到的消息:
Error at Contacts [SSIS.Pipeline]: input column "ObjectId" (914) has lineage ID 709 that was not previously used in the Data Flow task.
Error at Contacts [SSIS.Pipeline]: "component "OLE DB Destination" (134)" failed validation and returned validation status "VS_NEEDSNEWMETADATA".
Error at Contacts [SSIS.Pipeline]: One or more component failed validation.
Error at Contacts: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
的ObjectId是我在查找裏面選擇一個int 。查詢的整個查詢是:
DECLARE @ObjectId int
Select @ObjectId = (SELECT TOP (1) [Value] as ObjectId
FROM dbo.Sequences WHERE (Name = 'Contact'));
UPDATE Sequences SET Value = Value + 1 WHERE (Name = 'Contact');
SELECT ObjectId = @ObjectId, Reference = N'CU' + cast(@ObjectId as VARCHAR(20))
此查詢在預覽中完美工作。有人可以告訴我我做錯了什麼嗎?對我的無知抱歉,但這是我在SSIS中做的第一件事。
更新1(見@billinkc答案)
新設計:
新的錯誤:(
Error at Contacts [Lookup Sequence [531]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Syntax error, permission violation, or other nonspecific error".
Error at Contacts [Lookup Sequence [531]]: OLE DB error occurred while loading column metadata. Check SQLCommand and SqlCommandParam properties.
Error at Contacts [SSIS.Pipeline]: "component "Lookup Sequence" (531)" failed validation and returned validation status "VS_ISBROKEN".
Error at Contacts [SSIS.Pipeline]: One or more component failed validation.
Error at Contacts: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
我已經改變了它。它現在是內聯的,但我仍然遇到錯誤。很快會更新我的問題。是的,我感興趣。請告訴我。 – Kev 2013-03-12 17:06:34