![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#3
| |||
| |||
|
|
I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#4
| |||
| |||
|
|
Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#5
| |||
| |||
|
|
Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#6
| |||
| |||
|
|
Do you remember the posted subject name? Otherwise I will keep searching for it Tks JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OgIdkTNKFHA.1096 (AT) tk2msftngp13 (DOT) phx.gbl... Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#7
| |||
| |||
|
|
Throw me a mail and I'll post the package "JFB" <help (AT) jfb (DOT) com> wrote Do you remember the posted subject name? Otherwise I will keep searching for it Tks JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OgIdkTNKFHA.1096 (AT) tk2msftngp13 (DOT) phx.gbl... Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#8
| |||
| |||
|
|
Tks Allan, I really appreciate you help. j.balladares (AT) verizon (DOT) net Rgds JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:#cusrfNKFHA.3076 (AT) tk2msftngp13 (DOT) phx.gbl... Throw me a mail and I'll post the package "JFB" <help (AT) jfb (DOT) com> wrote Do you remember the posted subject name? Otherwise I will keep searching for it Tks JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OgIdkTNKFHA.1096 (AT) tk2msftngp13 (DOT) phx.gbl... Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#9
| |||
| |||
|
|
Allan, Tks for the example... now I have another problem. Sometimes we want to use the same source column in two diferent destination columns. I'm getting an error saying the Tranformatio_columName already exist. How can I fix that? Rgds JFB "JFB" <help (AT) jfb (DOT) com> wrote in message news:O2ilPnNKFHA.3296 (AT) TK2MSFTNGP15 (DOT) phx.gbl... Tks Allan, I really appreciate you help. j.balladares (AT) verizon (DOT) net Rgds JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:#cusrfNKFHA.3076 (AT) tk2msftngp13 (DOT) phx.gbl... Throw me a mail and I'll post the package "JFB" <help (AT) jfb (DOT) com> wrote Do you remember the posted subject name? Otherwise I will keep searching for it Tks JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OgIdkTNKFHA.1096 (AT) tk2msftngp13 (DOT) phx.gbl... Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
#10
| |||
| |||
|
|
It is relatively easy to do. The best way would be to design a package in designer that does what you want and then save as a VB module. Have a look in there at how DTS itself does it. Allan "JFB" <help (AT) jfb (DOT) com> wrote Allan, Tks for the example... now I have another problem. Sometimes we want to use the same source column in two diferent destination columns. I'm getting an error saying the Tranformatio_columName already exist. How can I fix that? Rgds JFB "JFB" <help (AT) jfb (DOT) com> wrote in message news:O2ilPnNKFHA.3296 (AT) TK2MSFTNGP15 (DOT) phx.gbl... Tks Allan, I really appreciate you help. j.balladares (AT) verizon (DOT) net Rgds JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:#cusrfNKFHA.3076 (AT) tk2msftngp13 (DOT) phx.gbl... Throw me a mail and I'll post the package "JFB" <help (AT) jfb (DOT) com> wrote Do you remember the posted subject name? Otherwise I will keep searching for it Tks JFB "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OgIdkTNKFHA.1096 (AT) tk2msftngp13 (DOT) phx.gbl... Yes you can do it dynamagically. I have posted before about a script I wrote in ActiveX task that took a Query, Parsed it, created a table in Excel and the created the mappings. Allan "JFB" <help (AT) jfb (DOT) com> wrote Tks for you reply and help Allan, Can i do this steps dynamicly? I have this for script on the transformation, ir works if I run the package manually, but If I change the source file the source columns remain there. Also the table has a primary key. Rgds JFB '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() 'Declare Variables Dim SourceArray, DestiantionArray, count, temp, Field 'Get Field values from GVs arrays SourceArray = Split(DTSGlobalVariables("SourceFields").Value, ",") DestinationArray = Split(DTSGlobalVariables("DestinationFields").Valu e, ",") count = 0 'Initialize counter 'Loop thru array and import columns to table For Each Field In SourceArray If Not IsNull(Field) then 'MsgBox Field DTSDestination(DestinationArray(count)) = DTSSource(Field) End if count = count + 1 next Main = DTSTransformStat_OK End Function "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:ORM#wMNKFHA.3132 (AT) TK2MSFTNGP12 (DOT) phx.gbl... I would do it like this 1. Remove existing transforms 2. Create a new transformation object for each source column 3. Add the SourceColumn to the Transformation 4. Add a DestinationColumn to the transformation 5. Add the transformation to the transformations collection Allan "JFB" <help (AT) jfb (DOT) com> wrote Hi All, Every time I importing a text file the columns name change. I can collect all the source columns in a string, when I call the pkg I pass this string as GV. In my Transformation I want to change change the name of the source columns. How can I do this ? Tks JFB |
![]() |
| Thread Tools | |
| Display Modes | |
| |