Is it possible when Importing data using a DTS Package to split 1 row of data into multiple rows i.e.
I have a list of consumable stores Items which uses a text field show which cost centres can use the items.
My data looks like this
Code Name Text
ABC1 SCREW Depts#01#02#03
ABC2 NAIL Depts#11SUR#20
ABC3 PUNCH Depts#16
What i need to do is write a row of data for each Code and Dept i.e.
Code Name Dept
ABC1 SCREW 01
ABC1 SCREW 02
ABC1 SCREW 03
ABC2 NAIL 11SUR
ABC2 NAIL 20
ABC3 PUNCH 16
I have written a script which loops through the item text and parses out the departments, but the transformation only writes the last line ti the database, i assume this is because it is just updating the same line.
can anyone point me in th eright direction to accomplish this
Thanks in advance
Gary Parker
Systems Support Analyst
Manchester, England
I have a list of consumable stores Items which uses a text field show which cost centres can use the items.
My data looks like this
Code Name Text
ABC1 SCREW Depts#01#02#03
ABC2 NAIL Depts#11SUR#20
ABC3 PUNCH Depts#16
What i need to do is write a row of data for each Code and Dept i.e.
Code Name Dept
ABC1 SCREW 01
ABC1 SCREW 02
ABC1 SCREW 03
ABC2 NAIL 11SUR
ABC2 NAIL 20
ABC3 PUNCH 16
I have written a script which loops through the item text and parses out the departments, but the transformation only writes the last line ti the database, i assume this is because it is just updating the same line.
Code:
'**********************************************************************
' Visual Basic Transformation Script
'************************************************************************
' Copy each source column to the destination column
Function Main()
'Declare and set required variables
Dim i
Dim HashCount
Dim strDept
Dim strChar
HashCount = 0
strDept = ""
'Loop through the item text 1 character at a time
For i = 1 to Len( DTSSource("TEXT") )
strChar = Mid(DTSSource("TEXT"),i,1)
If strChar = "#" Then
'Only print the line if not the 1st #
If strDept <> "" Then
DTSDestination("ITM_CODE") = DTSSource("CODE")
DTSDestination("ITM_NAME") = DTSSource("NAME")
DTSDestination("ITM_DEPT") = strDept
End If
'Update variables
HashCount = HashCount + 1
strDept = ""
Else
'once past the 1st # strat to build dept string
If HashCount <> 0 Then
strDept = StrDept & strChar
End If
End If
Next
'Write the last line
If strDept <> "" Then
DTSDestination("ITM_CODE") = DTSSource("CODE")
DTSDestination("ITM_NAME") = DTSSource("NAME")
DTSDestination("ITM_DEPT") = strDept
End If
Main = DTSTransformStat_OK
End Function
can anyone point me in th eright direction to accomplish this
Thanks in advance
Gary Parker
Systems Support Analyst
Manchester, England