Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:17:28+00:00 2026-05-30T13:17:28+00:00

I receive a daily CSV with duplicate records in it. I tried to import

  • 0

I receive a daily CSV with duplicate records in it. I tried to import it using BULK INSERT, but my primary key constraint throws me an error because of the duplicates.

To fix this, I am thinking about importing the data into a new table with no primary key constraint, and then using the following code:

INSERT INTO final_table(col1, col2, col3)
SELECT DISTINCT col1, col2, col3
FROM temporary_table

Is this the best way of going about this? Or is there an easier way to do this in SQL Server 2008?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:17:30+00:00Added an answer on May 30, 2026 at 1:17 pm

    This “new” table is called the staging table. It should have very little limitations… ie. constraints. Once loaded there, you scrub and load into your “final” table.

    I think what you’re proposing to do is the simplest. Unless you’re using SSIS and you’re adamant about not using a staging table. I generally like having a staging table around so I can see an exact replica of the file if something were to go wrong. Helps with troubleshooting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I receive a daily XML file that contains thousands of records, each being a
We receive lots of data as flat files: delimitted or just fixed length records.
I receive TypeError: Can't convert 'float' object to str implicitly while using Gambler.pot +=
I've a partial set up to bring in iTunes sales data I receive daily.
I'm going to receive a daily list of product prices and I need to:
Using $.ajax({..}) I receive the contents of an XML file from the server. So
I receive a get request from server, but is encrypted with a simple algorithm
I'm generating a bulk mailing each day for users who want to receive the
I've been trying to find a sensible way of storing daily data using Core
I receive a daily XML file which I use to update a database with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.