Home > Archive > MS SQL Server > February 2006 > duplicate in text file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author duplicate in text file
Johnfli

2006-02-09, 8:23 pm

I have my SQL server reads a text file into a temp table, then it copies
that data over to a main table, but it looks to see if a particular filed
has a certain value, if it does, it updates that record instead of creating
a duplicate.

But, what I am finding is that if the text file has duplicate records in it,
it will duplicate into the main table.

Any ideas on how I can weed out duplicates from the text file that I am
importing?


Edgardo Valdez, MCSD, MCDBA

2006-02-09, 8:23 pm

You can add an intermediate process to remove the duplicates after they are
loaded into the temp table and before perorming the insert or the update to
the main table.


"Johnfli" wrote:

> I have my SQL server reads a text file into a temp table, then it copies
> that data over to a main table, but it looks to see if a particular filed
> has a certain value, if it does, it updates that record instead of creating
> a duplicate.
>
> But, what I am finding is that if the text file has duplicate records in it,
> it will duplicate into the main table.
>
> Any ideas on how I can weed out duplicates from the text file that I am
> importing?
>
>
>

Jack Vamvas

2006-02-10, 7:23 am

Can't you insert everything into the temp table -- the do the SELECT
DISTINCT at the temp table? prior to entering into the main table

--
Jack Vamvas
____________________
____________________
____________________
______
Receive free SQL tips - register at www.ciquery.com/sqlserver.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
New article by Jack Vamvas - SQL and Markov Chains -
www.ciquery.com/articles/art_04.asp
"Johnfli" <john@ivhs.us> wrote in message
news:%23SPhtYdLGHA.2216@TK2MSFTNGP09.phx.gbl...
> I have my SQL server reads a text file into a temp table, then it copies
> that data over to a main table, but it looks to see if a particular filed
> has a certain value, if it does, it updates that record instead of

creating
> a duplicate.
>
> But, what I am finding is that if the text file has duplicate records in

it,
> it will duplicate into the main table.
>
> Any ideas on how I can weed out duplicates from the text file that I am
> importing?
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com