dbTalk Databases Forums  

SSIS - Column Iteration in Script Component

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SSIS - Column Iteration in Script Component in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gary Michaels
 
Posts: n/a

Default SSIS - Column Iteration in Script Component - 07-30-2005 , 09:44 AM






Is it possible to iterate through the columns (or fields) in a recordset row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some calculations on
the fields prior to normalizing the table.

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 07-30-2005 , 10:31 AM






When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote

Quote:
Is it possible to iterate through the columns (or fields) in a recordset
row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some calculations
on
the fields prior to normalizing the table.



Reply With Quote
  #3  
Old   
Gary Michaels
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 07-30-2005 , 01:32 PM



Currently we are looping through the rows in the script component from a sql
table as the source. Some of the columns are modified as we move through the
transformation, basically unpivoting the data (using the unpivot control
works but some things still require some code).
Because there are so many columns (e.g., Interval_1, Inteval_2,....,
Interval50) it would be great if we could refer to the fields as
row(colno).value instead of row.Interval_1. I looked around and found some
examples using the pipeline buffer but we couldn't get it to work. Of course
part of the problem is that we can't figure out how to do line-by-line
debugging yet.

Does this make any sense yet?




"Allan Mitchell" wrote:

Quote:
When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:9527CDF1-685A-4A9F-8AAB-E69F37230418 (AT) microsoft (DOT) com...
Is it possible to iterate through the columns (or fields) in a recordset
row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some calculations
on
the fields prior to normalizing the table.




Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 07-30-2005 , 02:43 PM



I have to say that I have never used an ordinal number for columns simply
because although in DTS it was faster, it was always prone to being
invlidated and if you can do the ordinal number thing in SSIS I would
imagine it suffers the same fate.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote

Quote:
Currently we are looping through the rows in the script component from a
sql
table as the source. Some of the columns are modified as we move through
the
transformation, basically unpivoting the data (using the unpivot control
works but some things still require some code).
Because there are so many columns (e.g., Interval_1, Inteval_2,....,
Interval50) it would be great if we could refer to the fields as
row(colno).value instead of row.Interval_1. I looked around and found some
examples using the pipeline buffer but we couldn't get it to work. Of
course
part of the problem is that we can't figure out how to do line-by-line
debugging yet.

Does this make any sense yet?




"Allan Mitchell" wrote:

When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a
transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:9527CDF1-685A-4A9F-8AAB-E69F37230418 (AT) microsoft (DOT) com...
Is it possible to iterate through the columns (or fields) in a
recordset
row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some
calculations
on
the fields prior to normalizing the table.






Reply With Quote
  #5  
Old   
Gary Michaels
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 07-30-2005 , 03:48 PM



Thanks. But what about the line-by-line debugging of the script component?


"Allan Mitchell" wrote:

Quote:
I have to say that I have never used an ordinal number for columns simply
because although in DTS it was faster, it was always prone to being
invlidated and if you can do the ordinal number thing in SSIS I would
imagine it suffers the same fate.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:4DB0773B-F6F1-4E0E-9F01-FA90A59F2745 (AT) microsoft (DOT) com...
Currently we are looping through the rows in the script component from a
sql
table as the source. Some of the columns are modified as we move through
the
transformation, basically unpivoting the data (using the unpivot control
works but some things still require some code).
Because there are so many columns (e.g., Interval_1, Inteval_2,....,
Interval50) it would be great if we could refer to the fields as
row(colno).value instead of row.Interval_1. I looked around and found some
examples using the pipeline buffer but we couldn't get it to work. Of
course
part of the problem is that we can't figure out how to do line-by-line
debugging yet.

Does this make any sense yet?




"Allan Mitchell" wrote:

When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a
transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:9527CDF1-685A-4A9F-8AAB-E69F37230418 (AT) microsoft (DOT) com...
Is it possible to iterate through the columns (or fields) in a
recordset
row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some
calculations
on
the fields prior to normalizing the table.







Reply With Quote
  #6  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 07-30-2005 , 04:28 PM



Debugging the Script component as a transform is not currently possible. it
will allow you to set a breakpoint but when the Data Floe task runs the
breakpoint is silently removed. I have asked MS to make this more apprent
and less silent.



--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thanks. But what about the line-by-line debugging of the script component?


"Allan Mitchell" wrote:

I have to say that I have never used an ordinal number for columns
simply
because although in DTS it was faster, it was always prone to being
invlidated and if you can do the ordinal number thing in SSIS I would
imagine it suffers the same fate.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:4DB0773B-F6F1-4E0E-9F01-FA90A59F2745 (AT) microsoft (DOT) com...
Currently we are looping through the rows in the script component from
a
sql
table as the source. Some of the columns are modified as we move
through
the
transformation, basically unpivoting the data (using the unpivot
control
works but some things still require some code).
Because there are so many columns (e.g., Interval_1, Inteval_2,....,
Interval50) it would be great if we could refer to the fields as
row(colno).value instead of row.Interval_1. I looked around and found
some
examples using the pipeline buffer but we couldn't get it to work. Of
course
part of the problem is that we can't figure out how to do line-by-line
debugging yet.

Does this make any sense yet?




"Allan Mitchell" wrote:

When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a
transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it
then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in
message
news:9527CDF1-685A-4A9F-8AAB-E69F37230418 (AT) microsoft (DOT) com...
Is it possible to iterate through the columns (or fields) in a
recordset
row
using the script component? I am working with a table that has over
50
columns of similar type data fields and need to perform some
calculations
on
the fields prior to normalizing the table.









Reply With Quote
  #7  
Old   
Darren Green
 
Posts: n/a

Default Re: SSIS - Column Iteration in Script Component - 08-01-2005 , 02:59 AM



Log it on MSDN Product Feedback.. The pre-generated code does not allow
this, but it would be a simple change to include an Item indexer. In fact it
is there, but not exposed, and you cannot edit the generated code to fix it,
although this would probably be a bad idea since it would get overwritten.


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote

Quote:
Currently we are looping through the rows in the script component from a
sql
table as the source. Some of the columns are modified as we move through
the
transformation, basically unpivoting the data (using the unpivot control
works but some things still require some code).
Because there are so many columns (e.g., Interval_1, Inteval_2,....,
Interval50) it would be great if we could refer to the fields as
row(colno).value instead of row.Interval_1. I looked around and found some
examples using the pipeline buffer but we couldn't get it to work. Of
course
part of the problem is that we can't figure out how to do line-by-line
debugging yet.

Does this make any sense yet?




"Allan Mitchell" wrote:

When you say iterate? and what do you mean by a recordset row?

You can loop over a recordset in the Control Flow.

You can attach a source to the Script component, have it ast as a
transform
and you can perform operations on the row.

What exactly do you want to do as there may be better ways to do it then
that script component.


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Gary Michaels" <GaryMichaels (AT) discussions (DOT) microsoft.com> wrote in message
news:9527CDF1-685A-4A9F-8AAB-E69F37230418 (AT) microsoft (DOT) com...
Is it possible to iterate through the columns (or fields) in a
recordset
row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some
calculations
on
the fields prior to normalizing the table.






Reply With Quote
  #8  
Old   
David Hassell
 
Posts: n/a

Default RE: SSIS - Column Iteration in Script Component - 09-17-2007 , 08:24 AM



I have a similar issue, I have 26 columns in the input buffer and based on
some conditions I need to copy the data from the input0buffer to an
output1buffer. I would like to be able to loop through the input buffer with
a for loop similar to what would be used in ado "for i = 0 to rs.fields.count
-1" etc. to copy them instead I am currently doing the outrow.addrow() :
outrow.field = inrow.field.

I am very new to .Net and though I may be wrong it seems a huge miss to me.


"Gary Michaels" wrote:

Quote:
Is it possible to iterate through the columns (or fields) in a recordset row
using the script component? I am working with a table that has over 50
columns of similar type data fields and need to perform some calculations on
the fields prior to normalizing the table.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.