Hi,
I'm creating a DTS package in MSSQL Server 2000. In this package I wanna copy some colums from an excel-sheet to a existing table in my sql database.
now it could happen that the data isn't unique. so i have sometimes the same row twice (or more). Now my question is, is there a way to get rid of those data, so that I have it only once? (like the group by funktion in sql)
activeX code looks like the following. I'm a noob in activeX and VB, so if anyone has a hint or solution, would be great.
' Copy each source column to the destination column
Function Main()
DTSDestination("TypeOfCode") = DTSSource("Type of Code")
DTSDestination("IndustryName") = DTSSource("Industry Name")
DTSDestination("IndustryCode") = DTSSource("Industry Code")
DTSDestination("GroupName") = DTSSource("Group Name")
DTSDestination("GroupCode") = DTSSource("Group Code")
Main = DTSTransformStat_OK
End Function
GroupCode should be unique in the destination table. maybe there is a way jumping over a row, if the GroupCode already exist? Something like check if GroupCode equals the GroupCode of the row before...
another way could be, deleating every row where GroupeCode exist more than once...
best would be something like a group by function...
thanks in advance,
Namh
I'm creating a DTS package in MSSQL Server 2000. In this package I wanna copy some colums from an excel-sheet to a existing table in my sql database.
now it could happen that the data isn't unique. so i have sometimes the same row twice (or more). Now my question is, is there a way to get rid of those data, so that I have it only once? (like the group by funktion in sql)
activeX code looks like the following. I'm a noob in activeX and VB, so if anyone has a hint or solution, would be great.
' Copy each source column to the destination column
Function Main()
DTSDestination("TypeOfCode") = DTSSource("Type of Code")
DTSDestination("IndustryName") = DTSSource("Industry Name")
DTSDestination("IndustryCode") = DTSSource("Industry Code")
DTSDestination("GroupName") = DTSSource("Group Name")
DTSDestination("GroupCode") = DTSSource("Group Code")
Main = DTSTransformStat_OK
End Function
GroupCode should be unique in the destination table. maybe there is a way jumping over a row, if the GroupCode already exist? Something like check if GroupCode equals the GroupCode of the row before...
another way could be, deleating every row where GroupeCode exist more than once...
best would be something like a group by function...
thanks in advance,
Namh