![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
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. |
#6
| |||
| |||
|
|
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. |
#7
| |||
| |||
|
|
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. |
#8
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |