Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 SSIS Variable to Parameter to SQL Mapping

Author  Topic 

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-02-05 : 12:00:32
An interesting article here about type mapping:

http://msdn.microsoft.com/en-us/library/ms345165(SQL.90).aspx


That link is mostly helpful but it leads to more questions:

1. Can we use the methods described in our SSIS packages? How? (Examples)

2. Is there a mapping of SSIS variable types to Parameter types and Parameter types to SQL types?

e.g The system variable System:StartTime is of type DateTime (in the Variables tab).

In the Execute SQL task, in the Parameters tab, there is no type DATETIME in the drop-down. There is DATE, DBDATE, DBTIMESTAMP and some others. Note that they are not the same as the variable types (thanks, SSIS, for making life difficult!)

Say that you want to pass the variable System::StartTime to a query in an Execute SQL Task where the SQL data type is DATETIME. We have:

Variable Variable Type SQL type Parameter tab type
----------------- ------------ -------- ------------------
System::StartTime DateTime DATETIME ???


By process of elimination, I discovered that the Parameter type in this case is DATE. That is confusing, since it actually does pass in the time as well.

Now, there are several SSIS variable types (11 in 2008-r2) and several Parameter types (27 in 2008-r2) and lots of SQL types. Is there a matrix somewhere that maps all three together?
   

- Advertisement -