0

I have a query in my ssis package that uses xml path to return a single row of semi colon separated values in a execute sql task. I have a user var called email_list that is then set to the ResultSet as a Single row. But when I run it, I get an error:

The value type (___ComObject) can only be converted to variables of type object

I realize that the variable email_list has to be set to type Object, but if I do that, and then try to use that in the ToLine field in expression builder of email task, the expression doesn't evaluate and throws an error.

I've seen articles on here that give a script task solution but I don't want any scripts - how can this be accomplished in the expression builder itself by converting/casting the object to string?

If it can't be done in the expression builder, what is the workaround?

My query in the execute sql task is:

SELECT STUFF((SELECT ';' + email 
        FROM booklist..books
        FOR XML PATH('')) ,1,1,'') AS email_address
3
  • Is there a reason you're storing XML in an variable of Object type instead of String Commented Aug 10, 2016 at 15:37
  • @billinkc - I used stuff() so I could get a single row of semi colon separated values like so: [email protected];[email protected];[email protected] Commented Aug 10, 2016 at 16:11
  • Can't you just wrap the stuff call with 'cast(stuff... As varchar(8000)) as ToList' Commented Aug 10, 2016 at 16:21

2 Answers 2

1

The expression language doesn't support object types. In your case, you should be able to cast the resultant into a string data type

SELECT CAST(STUFF((SELECT ';' + email 
        FROM booklist..books
        FOR XML PATH('')) ,1,1,'') AS varchar(8000)) AS email_address
Sign up to request clarification or add additional context in comments.

Comments

0

If you are taking the input from SQL query then you can change it into String using the cast function ..

From Proc output ::
Select @output 
we can take it this way,
Select cast(@output as varchar) 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.