![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi guys, I am creating a DTS in SQL server by importing from a tab sep file, I realized that one field could contain multiple, comma separeted, values: eg. Field1 Field2 Field3 Date etc.. Normal: 160 2827863 15489229 2005-03-07 21:10 .... Exeption: 197 2827867 15200387,2371987239,02109283,23812319,120310928310 2005-03-07 21:19 .... I'd like to know if it possible to do the following, which conceptually is not difficult. So I my idea was while it is copying the Source fields into the destination ones perform a check and if the field is multple then create more records in that table: here is the stupid code I wrote in the DTSTransformation ActiveX Transformation windows Function Main() Dim SplittedCells Dim CellContent SplittedCells = Split(DTSSource("Col003"), ",") For i = LBound(SplittedCells) To UBound(SplittedCells) Step 1 DTSDestination("TaxID") = DTSSource("Col001") DTSDestination("GeneID") = DTSSource("Col002") DTSDestination("LastUpdate") = DTSSource("Col004") DTSDestination("GeneRifText") = DTSSource("Col005") DTSDestination("PubmedID") = SplittedCells(i) ---> Here there should be an .Addnew-like command...and .Update-like also <--- Next Main = DTSTransformStat_Ok End Function My question is: is there anybody who knows if it is possible to do...if it is the correct way... Thanks in advance... |
#3
| |||
| |||
|
|
This article should help you Processing The Same Row More Than Once (http://www.sqldts.com/default.aspx?266) Allan "P.Guarnieri (AT) cmbi (DOT) ru.nl" <P.Guarnieri (AT) cmbi (DOT) ru.nl> wrote in message news:AUvWe.30615$nT3.7214 (AT) tornado (DOT) fastwebnet.it: Hi guys, I am creating a DTS in SQL server by importing from a tab sep file, I realized that one field could contain multiple, comma separeted, values: eg. Field1 Field2 Field3 Date etc.. Normal: 160 2827863 15489229 2005-03-07 21:10 .... Exeption: 197 2827867 15200387,2371987239,02109283,23812319,120310928310 2005-03-07 21:19 .... I'd like to know if it possible to do the following, which conceptually is not difficult. So I my idea was while it is copying the Source fields into the destination ones perform a check and if the field is multple then create more records in that table: here is the stupid code I wrote in the DTSTransformation ActiveX Transformation windows Function Main() Dim SplittedCells Dim CellContent SplittedCells = Split(DTSSource("Col003"), ",") For i = LBound(SplittedCells) To UBound(SplittedCells) Step 1 DTSDestination("TaxID") = DTSSource("Col001") DTSDestination("GeneID") = DTSSource("Col002") DTSDestination("LastUpdate") = DTSSource("Col004") DTSDestination("GeneRifText") = DTSSource("Col005") DTSDestination("PubmedID") = SplittedCells(i) ---> Here there should be an .Addnew-like command...and .Update-like also <--- Next Main = DTSTransformStat_Ok End Function My question is: is there anybody who knows if it is possible to do...if it is the correct way... Thanks in advance... It took me awhile to understand a couple of things (ie. I didn't know |
![]() |
| Thread Tools | |
| Display Modes | |
| |