Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check double data in tables

Status
Not open for further replies.

Namh

IS-IT--Management
Mar 22, 2006
21
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top