QQFA2
QQFA2

Reputation: 31

Checking SSIS variable of Object data type for NULL Value

everyone, In my SSIS package, I have a variable FilesInfo of Object data type that gets its values from the Full Result Set from an Execute SQL task, which may or may not return any results. I have a Foreach loop container to do further processing. If the values are not null, the package executes successfully. However, it throws an error when nothing returned fromthe SQL task. To fix this, I want to add a Precedence Constraint to direct the flow only when FilesInfo is NOT NULL. Is there a way to do it? And if so, what is the exact syntax? Thank you for your help in advance. Regards

Upvotes: 1

Views: 3804

Answers (1)

Ako
Ako

Reputation: 1221

It looks like that your query does not return an empty table in case there is nothing to do.

IF NOT EXISTS (select * from FileTypeTable where filetype = 'xxx') 
select 'f1' as fileName, 'p1' as parameter 
union all 
select 'f1' as fileName, 'p1' as parameter

The easiest solution would be rewriting your query.

 select 'f1' as fileName, 'p1' as parameter 
 from fileTableA
 where condition 
 union all 
 select 'f1' as fileName, 'p1' as parameter
 from fileTableB
 where condition 

Upvotes: 1

Related Questions