Solved

Skipping duplicate records while DTS transformation using VB

Posted on 2003-11-03
5
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 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 200 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Format Date fields 11 64
Display SQL maintenance plan SQL Code 3 47
Display Date and Time 7 48
Load Fact table in SQL Server SSIS package 14 44
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

734 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