Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 re: Protecting Client data during dedupe

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-06 : 08:12:45
Elena writes "Below is the code I am currently using to dedupe my data. While this works fine, I am not able to protect my client data (filecode 'c') and update the query_id on purchased data (filecode 'p') because SQL has to use the uniqueid field. My data comes in at different times. Purchased lists come in days before the client data, but since they have been imported first, they have the min(uniqueid) instead of the client data.

Is there any way other than creating a new uniqueid field based on an index that sorts by filecode to achieve the goal I need? My only reason for not wanting another field is for space reasons. Most files are over 200,000+ records



Update [ClientData_temp]
set Query_ID = 'DUPES'
from [ClientData_temp]a
where uniqueid not in(select MIN(uniqueid) from [ClientData_temp] B WHERE UPPER(B.LASTNAME) = UPPER(a.LASTNAME)
AND UPPER(B.ADDRESS1) = UPPER(a.ADDRESS1)
AND B.ZIP = a.ZIP
AND B.NTRNLKYCD = A.NTRNLKYCD
AND QUERY_ID IS NULL)


Thanks in advance,

Elena"
   

- Advertisement -