NULL Showing up as 0 via a variable
I have a simple EXEC SQL TASK where I do SELECT NULL as value Then I assign that value to a package variable defined as int32. After this EXEC SQL, I have a dummy container and I have a precedent contraint based on this variable where I specify !ISNULL(@variable). In other words, only go to the dummy container if the EXEC SQL TASK returns a non NULL value. So, the behavior I want is, when I have SELECT NULL as value, I don't want it to go to the next container. But when I do SELECT NULL as value, it still goes to the next container because somehow the NULL got converted to the number 0. What am I missing here?
June 29th, 2012 4:10pm

You do not need a Execute SQL to get the null use a derived column transformation with an expression (NULL)(DT_I4). This failure I guess in in the assignment - the Int32 comes with a non null value, but 0 Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2012 4:44pm

I think SSIS doesn't support nullable types for its variables... maybe you could use a TSQL ISNULL or COALESCE to replace the null value for something unlikely that you could use in your check.Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter
June 30th, 2012 1:31pm

I think SSIS doesn't support nullable types for its variables... maybe you could use a TSQL ISNULL or COALESCE to replace the null value for something unlikely that you could use in your check.Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2012 1:37pm

SSIS variables are not nullable .NET objects. If you will try to assign null, it will be assigned default value. To store null as a variable you need to declare variable type as "object" and use it only in .NET code (script tack), map it to "int32?". Doing it is really inconvenient. For other solution you can check following post: http://social.msdn.microsoft.com/Forums/eu/sqlintegrationservices/thread/f9d18fd6-d0ee-4b4e-b774-635fbafd59b3
June 30th, 2012 6:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics