SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Parsing an ADO result set into a comma separated string in SSIS


Parsing an ADO result set into a comma separated string in SSIS

Author
Message
petr.novak
petr.novak
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 128
Hello,
try this select (this pivots rows to one string row):
select stuff((select top 10 ',"' + code + '"' from Products order by code for XML path('')), 1, 1, '');
stephen.bray
stephen.bray
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 3
Hi. I have tried to following your example posted here verbatim, however, whenever I execute my package it fails on the Execute SQL Task within the Foreach loop. I get the following error
"Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query ""SELECT '"+@[User::FileList]+","+@[User::MissingFi..." failed with the following error: "Incorrect syntax near '+'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task"

What should I look for that I may have overlooked earlier?

My variables
name datatype value
sql_str String "SELECT '"+@[User::FileList]+", "+@[User::MissingFileName]+'" as FileList"
MissingFiles Object
MissingFileName String
FileList String
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search