2009-05-18 13 views
3

Ich versuche, einen SQL-Task Execute in SSIS 2008 zu verwenden, um einen Ausgabeparameter für eine Geschäftsprozedur einer Paketvariablen zuzuordnen.SSIS 2008 Ausführen von SQL-Ausgabeparameterzuordnung datetime2 Problem

Die Paketvariable ist SSIS-Typ DateTime und der Speicherprozedurparameter ist SQL-Typ DATETIME.

Die SQL-Anweisung ist EXEC GetCurrentDate @CurrentDate=? und im Parameter-Mapping-Bildschirm wird der Parameter der Paketvariablen mit der Richtung Ausgabe und dem Datentyp DBTIMESTAMP zugeordnet.

Wenn ich laufe das Paket ich die folgende Fehlermeldung erhalten:

[Execute SQL Task] Error: Executing the query "EXEC GetCurrentDate @CurrentDate=? " failed with the following error: "The type of the value being assigned to variable "User::CurrentDate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Wenn ich eine Spur auf der Abfrage ist Lauf betreibe ich die Art sehen wird als datetime2 angenommen:

declare @p3 datetime2(7) 
set @p3=NULL 
exec sp_executesql N'EXEC GetCurrentDate @[email protected] ',N'@P1 datetime2(7) OUTPUT',@p3 output 
select @p3 

Does Wer weiß, warum der Typ Datetime2 ist?

Dank

Antwort

3

die Antwort auf eine Micorsoft Connect Bugreport Gefunden:

We are closing this case as this is expected behaviour and is a result of the new sql datetime type change. You are using a native oledb connection manager for sql task, in the process of COM interop, we use VARIANT to hold the value and the only way to prevent data loss is to store the value as BSTR variant. If you change User::dateParam to String type it will work, or you can switch to use managed connection manager to bypass the COM interop.

http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=307835

0

Versuchen Sie, die inout/Ausgabeparameter als DATE statt DBTIMESTAMP in der SSIS Aufgabe angeben.

Dies funktioniert sicherlich in SSIS 2005-Pakete, an denen ich gearbeitet habe.

Es lohnt sich auch einen Blick auf this link, die dies sowie ein paar andere Probleme mit SSIS und Daten abdeckt.

Verwandte Themen