Personally I validate a text file by importing it into a working table and
then running TSQL over the top. So you duplicate PK would be easy
Either you set a PK on the working table or you do something like
SELECT PK_COL, COUNT(*)
FROM TABLE
GROUP BY PK_COL
HAVING COUNT(*) > 1
--
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"John" <jrp210 (AT) yahoo (DOT) com> wrote
Quote:
I created a DTS package that downloads a text file from an ftp site,
deletes the existing data in the sql table, and then inserts the new
data from the text file. The package works but I have run into
instances where the source text file has invalid data - duplicate
primary keys. When this happens the data doesn't get loaded and I end
up with an empty table.
My question is what checks can I put in place (and how can this be
done) so I am not left with an empty table? If an error like this
were to occur, I would like to know as well.
Thanks. |