?
Solved

Skipping duplicate records while DTS transformation using VB

Posted on 2003-11-03
5
Medium Priority
?
433 Views
Last Modified: 2008-03-17
I want to Import several delimited text files into SQL Server using DTS. If i am not using any Index on the table, my program work fine but if i use primary index, on the very first violation of the index DTS Rollbacks all the imported data and thus in effect importing no data at all.

How can i eliminate this?

I want to import million records at a time that may contain duplicate records too and i want to skip duplicate records while importing records in one go.

I don't want to use temporary tables in this process.
0
Comment
Question by:agarwalyogi
3 Comments
 

Expert Comment

by:charlotte1
ID: 9671076
You can loop and import the records one by one.  Each time before you import your row, you can check if the primary key already exists, if it does then you can just loop to the next one, if not, import it.
0
 
LVL 3

Accepted Solution

by:
SQLMaster earned 800 total points
ID: 9671099
Hi agarwalyogi,

You can combine your several delimited files into one single delimited file and then use SQL query in DTS wizard to eliminate duplicate records from your delimited file and then export to SQL server.

Cheers!

Dheeraj

0
 
LVL 34

Expert Comment

by:arbert
ID: 9672326
So what if the primary key is the same but there are differences in the rest of the records?

You can also set your "max error count" to be 9999 and it will consider it a "warning" and not abort....
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question