SSIS: NULL value in variable with double datatype


Seems SSIS is having issues with NULL values passed to variables. I'm loading results from a stored procedure into a variable of type object. I then need to insert the data from the object in a table. This is done with a foreach loop. But when the sql task hits the NULL value it fails. The datatype for the NULL value is double. I've tried to catch the NULL value through the EvaluateAsExpression (ISNULL(@[User::intUptime]) ? (DT_R8) 9999 : (DT_R8) @[User::intUptime]) but with no luck. Is this a known issue in SSIS? Version used SQL Server 2008 R2

Thanks in advance,


more ▼

asked Nov 03, 2011 at 07:21 AM in Default

avatar image

Olivier Lammens
1 1 1 1

Can you please append the error output? Thanks.

Nov 04, 2011 at 12:27 AM Usman Butt
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

For tables, SSIS takes the underlying data type. For stored procs, SSIS must read the first SELECT statement to retrieve metadata for what it expects the stored proc to return. In your stored proc, use a no-op select statement to declare the meta-data for the given columns, i.e.

 CAST(NULL AS <datatype>) AS ColumnName,
 CAST(NULL AS <datatype>) AS ColumnName,
 CAST(NULL AS <datatype>) AS ColumnName
more ▼

answered Nov 03, 2011 at 11:17 AM

avatar image

112 1 3 6

Unfortunately changing the SP is not an option. It is not managed by our team.


Nov 04, 2011 at 12:26 AM Olivier Lammens
(comments are locked)
10|1200 characters needed characters left

You cannot use variable of type [System.Object] is not convertible to the SSIS data types.

In case you have a NULL value in it and want to handle it, you will have to use the Script Task to handle the NULL.

more ▼

answered Nov 06, 2011 at 12:17 PM

avatar image

Pavel Pawlowski
22.7k 10 15 26

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Nov 03, 2011 at 07:21 AM

Seen: 2220 times

Last Updated: Nov 03, 2011 at 07:21 AM

Copyright 2018 Redgate Software. Privacy Policy