Showing posts with label destination. Show all posts
Showing posts with label destination. Show all posts

Wednesday, March 7, 2012

Recordset Destination with Foreach Loop Container - finding indexes

I'm curious to know how other people are handling the Recordset Destination in to be processed by a Foreach Loop Container. It seems a little odd to me that you can only map the parameters by knowing the index of the columns of the Recordset, however, the order that you built the recordset destination doesnt stay the same. I've been debugging for a while to find out that after I saved my recordset destination the order of the fields changed. To some order without a clear logic. I'm going to guess it might be the lineage id.

The bigger problem was this was a really large record set with 60 or so columns. To try and debug the problem of finding the indexes, I had added a Multicast tranform and saved the output to an Excel Destination. Of course, the order I setup the Excel file was the order I got the fields. Why would this not be the case with the Recordset Destination?

I've never seen this behaviour. Its possible to define the order of the fields within the recordset destination. It is the order in which you select columns on the "Input Columns" tab.

-Jamie

|||

Strange. I know I saw it earlier tonight, however I just remote desktoped into my work machine to capture a quick video of it happening, and it worked right this time. I'll try it again in the morning, I'd be more than happy if it was working right (despite having to reorder my indexes again).

|||

There's lots to be said for being a name not a number.

I guess a suggestion at the product feedback centre is required.

Recordset destination used in a FOREACH?

Hi all,

Can a Recordset destination be used as source for a ForEach loop.

Correct me if i'm wrong but the Recordset is stored in a variable of type Object? So what stops my ForEach loop from itterating?

Regards,

Pieter

Well, there are about 70-80 examples of using a recordset as a foreach enumerator (source) between BOL, google groups, and this MSDN forum. Shorter answer, yes.

Here's a good example from Jamie Thompson, http://blogs.conchango.com/jamiethomson/archive/2005/07/04/1748.aspx, which not only has verbiage, but a .dtsx file as well.

|||Thanks for the reply. After my post i tried a test project and it worked 100%. I then tried again in my actual project and no luck. Since then I rebuilt my entire work project around the test project and it is still working....go figure

Recordset destination used in a FOREACH?

Hi all,

Can a Recordset destination be used as source for a ForEach loop.

Correct me if i'm wrong but the Recordset is stored in a variable of type Object? So what stops my ForEach loop from itterating?

Regards,

Pieter

Well, there are about 70-80 examples of using a recordset as a foreach enumerator (source) between BOL, google groups, and this MSDN forum. Shorter answer, yes.

Here's a good example from Jamie Thompson, http://blogs.conchango.com/jamiethomson/archive/2005/07/04/1748.aspx, which not only has verbiage, but a .dtsx file as well.

|||Thanks for the reply. After my post i tried a test project and it worked 100%. I then tried again in my actual project and no luck. Since then I rebuilt my entire work project around the test project and it is still working....go figure

Recordset Destination and foreach loop

I have a csv file in which I am reading into a recordset destination and want to than use a foreach loop to cycle through those records and do some things. The problem I am having is after defining the variable name of the records set as results, and than going into the foreach loop, choosing collection, using the foreach ado enumerator, i dont see anything in the dropdown under ado object source varable? I am new to SSIS but I basically want to parse through this file, change some columns in each line and than either update or insert data in a sql table.See the following post for a tutorial on shredding a recordset: http://www.sqlis.com/59.aspx|||

appreciate the quick response, although like I said

i dont see anything in the dropdown under ado object source varable?

|||What scope is your recordset variable at? Is it a package scope or a task / transform scope?

Recordset Destination

Every time I try to us a recordset destination for error output, I have problems with setting the "VariableName" field. Is this a known issue? Or am I just doing something wrong?

Thanks
Jim

Jim,
Can you elaborate on what the problem is? An error message would be helpful.

My only tip based on what you have said is make sure that the type of the variable to which you are assigning the recordset is "Object".

Regards
Jamie|||Here is the text I get

Error 3 Validation error. Data Flow Task: Recordset Destination [332]: The VariableName property is not set to the name of a valid variable. Need a runtime variable name to write to. Package.dtsx 0 0|||Have a look here and see if it helps

This is the June CTP

Shredding a Recordset
(http://www.sqlis.com/default.aspx?59)|||In addition to having to point to a variable of type "Object", this property is also case sensitive. You may want to specify the variable's namespace as well.

Other than that I can't think what's wrong because I have had this working!

-Jamie|||Thanks Allan.

Pretty simple and I figured it was something like this. I didn't realize I needed a "variable" to hold onto my recordset.

Jim|||You need to create a variable by providing a name, of type object and also the scope of the variable. Check your object type.

I have written a book for beginners and even if you are not you may benefit from reading it. I recommend as it gives you a more deeper understanding of packages as implemented in the Visual studio 2005

http://www.packtpub.com/sql-server-integration-services-visual-studio-2005/book