Friday, February 17, 2012

DTS import question

I have a database table that stores personnel records that is imported from another source. I have SSN as a unique key.

Everyday I import data from a text file via DTS that checks for any updates to my records. If the data is updated I update my records, if there is new records I just add them to my table. The problem is every once in a while a duplicate ssn may appear in the text file I import. This causes my import to fail obviously because of the unique key on SSN. How do I allow DTS to continue and just ignore the problematic SSN? Can I write the conflicting SSN or error to a file somewhere?

if you're using a DTS you can check ifsomething has failed and write to an error log or send an email,however, you can't just continue from where the problem occurred,you'll have to manually check the error and sort it before running itagain.
To configure logging for your package, right click on the package inDTS Designer, select 'Package Properties'. Go to 'Logging' tab. In thistab, specify the error file, as well as the SQL Server to which youwant to log the package execution. When logging to SQL Server, theinformation will be logged into sysdtspackagelog and sysdtssteplogtables in the msdb database.
Taken from http://vyaskn.tripod.com/sql_server_dts_best_practices.htm troubleshooting section.
|||

"One way of doing this would be to create a duplicate loading table. On the
UNIQUE index specify WITHIGNORE_DUP_KEY.
This will allow you to load the rows and SQL server will only load a
distinct version of the row based on that index.

You then push the rows that are processed into the real table "
I got the above from the SQL Server news groups and that was exactly what I thought you should do. Run a search on DTS and IGNORE_DUP_KEY on Google . Hope this helps. For more DTS questions check out the link below.
http://www.sqldts.com

No comments:

Post a Comment