Beruflich Dokumente
Kultur Dokumente
July
search...
26
2010
Username
Lost Password?
No account yet?
Register
• Solved - Retrieving the COM class • How to make LIMIT (from, to) in MSSQL
factory for component with CLSID in 2005
SSIS • Object search in MSSQL 2005
• Find all tables with column name • Convert online CSV to SQL query
• How to merge 2 tables into one result • OUTPUT command in MSSQL 2005
in MySQL • OUTPUT command and varibles in
• How to drop column with default MSSQL 2005
constraint
• Loop through ADO recordset in SSIS
Main Menu
Home
MSSQL
www.Aptech-Education.com Ads by Google
MySQL
Utilities
Home
CSV to SQL
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010
SELECT SQL and upgrade your Performance - Loop through ADO recordset in SSIS Page 2 of 6
Syndicate
The most important part is in Result Set page. We specify that we want use a variable for this recordset. Right now we
need to create some variable. In Result Set tab in Variable Name column you can select <New variable ...> and create it.
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010
SELECT SQL and upgrade your Performance - Loop through ADO recordset in SSIS Page 3 of 6
We have to open properties of this container now and open Container page. Select Foreach ADO Enumerator. Then
select objProduct from previous step as an ADO object source variable. Enumeration mode should be set to Rows in the
first table.
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010
SELECT SQL and upgrade your Performance - Loop through ADO recordset in SSIS Page 4 of 6
On next page, Variable Mapping, here we can setup variables using inside loop. You select variable (if it doesn't exist yet
you can create it from here) and specify which column value will be inserted into by Index number. First column in
resultset is 0, second is 1 etc.
The loop environment is ready and we can create whatever we want inside loop.
I created Script Task and set variables for reading which I want to use.
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010
SELECT SQL and upgrade your Performance - Loop through ADO recordset in SSIS Page 5 of 6
Inside the Design Script I am using just simple Visual Basic script, that shows a message box for each loop:
MsgBox(CType(Dts.Variables("ProductName").Value, String))
Dts.TaskResult = Dts.Results.Success
Download example
And that's it. Because best is just take a look at example and play with it, here you can download this example SSIS
package and try to work it.
Download example SSIS package
Tag it:
Comments
#4 Vicky 2010-06-24 20:48 0
Thanks so much!!! So detailed and to the point. This was BIG help!!!!!
Quote
#3 Jane 2010-01-26 09:36 0
THank you. The example you provided has been most helpful.
Quote
#2 Chris Page 2009-12-21 16:38 0
I've just spent an hour trying to make this work! Your code works perfectly. Interpreted to mine it fails. Was
reaching that "throw the machine out the window" stage when I had an idea. When embedded in other code this
seems to only work when embedded in a sequence container to ensure that the EST happens before the FeLC.
Quote
#1 harty 2009-08-21 12:16 0
Just wanted to say Thank you for your blog. I really appreciate such resources where people write about real life,
real problems, real joy... Your resource belongs to my favorites.
Quote
Add comment
Name (required)
E-mail (required)
Website
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010
SELECT SQL and upgrade your Performance - Loop through ADO recordset in SSIS Page 6 of 6
Refresh
Send
JComments
< Prev
[ Back ]
Created by: Stanislav Duben, all rights reserved. Used template: sun:blogger
Hosted by: AfroDita hry online | Zásady ochrany osobních údajů
http://www.select-sql.com/mssql/loop-through-ado-recordset-in-ssis.html 7/26/2010