ssis object variable
Hi...I am relatively new at this so forgive my ignorance... I have written a script task that populates a multi-dimensional array. That part seems to be working fine. The array basically has a list of questions (coded by numbers) and the number of responses received. For example: 23568374, 53; 4235234, 53; question, items answered; and so on. It is my hope to put this into a table in my database. column1 would be the question, and column2 would be the return rate. As stated earlier, within the script task the array works like a champ. In SSIS I declared varReturnRate as an object. I was hoping to use a for each loop container to loop through it and place items in the database. The last line in script task is this: Dts.Variables("varReturnRate").Value = returnratearr. (returnratearr is a multidimensional array) This does in fact get the data to where I need it to be. I can put a watch on it. The problem is, when I look at the variable type....It is no longer an object, but is showing as string[]. I need a way to populate the variable, so I can use the ADO enumerator on it to populate my database. Any questions. Thanks
May 19th, 2012 12:27pm

I think that you need to use the Foreach from variable enumerator if you are going to enumerate through this multidimensional array. However, I think that your scenario might call for using the Script Component (not Script Task) as a Source in the data flow. Russel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Blog: http://www.bidn.com/blogs/RussLoski/ Twitter: @sqlmovers
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2012 12:50pm

Thanks for the reply..The variable looks like this, when I use a watch on it: So in the database I would like to see: Col1 Col2 Send_Transcript 53 and so on. Currently I am seeing: Col1 Col2 Send_Transcript Send_transcript 53 53 So i am not doing something right. In my foreach loop for parameter mappings I have : In my execute SQL task, for the SQL statement I have this: insert into stg.livepersondata (col1,col2) values (?,?) and for my parameter mappings in that I have: User:varQuest Direction, Input ,Data Type= Varchar, Parameter = 0 and Parameter Size -1 User:varTotal Direction, Input, Data Type = Varchar, Parameter = 1 and Parameter Size -1. Any help is appreciated. Thanks
May 19th, 2012 1:16pm

I can't get this to work either. It is iterating though the array one string at a time. I would use a script as a source: http://www.rad.pasfu.com/index.php?/archives/38-Script-Component-as-Source-SSIS.htmlRussel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Blog: http://www.bidn.com/blogs/RussLoski/ Twitter: @sqlmovers
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2012 6:56pm

I can't get this to work either. It is iterating though the array one string at a time. I would use a script as a source: http://www.rad.pasfu.com/index.php?/archives/38-Script-Component-as-Source-SSIS.htmlRussel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Blog: http://www.bidn.com/blogs/RussLoski/ Twitter: @sqlmovers
May 19th, 2012 6:59pm

Thanks...I got it to work as a script component. Runs well, and surprisingly I did not have to modify that much in my code. I have to say...It sucks you cannot use breakpoints to debug script components lol Thanks again, Dan
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2012 8:06pm

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

Other recent topics Other recent topics