473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Best way to add to DB while checking for duplicates

Situation:
Day 1
Table contains 100 items of actions imported via FTP. One of the fields
in the table can be updated to reflect an assigned unit code.
Day 2
Actions that may be duplicates of the table from Day 1 (with the
exception of the updated assigned unit field) are imported for
inclusion in the Table from Day 1.

Question- What is the best way to insure that any new items are added
to the table and that no duplicates are added at the sametime?

Assistance would be appreciated.

Jul 23 '05 #1
1 1182
A common solution is to load your data into a staging table which has
the same structure as the destination table. You can then use a query
like this to import only new rows:

insert into
dbo.Destination (col1, col2, ...)
select
col1, col2, ...
from
dbo.Staging s
where not exists (
select *
from dbo.Destination d
where s.keycol = d.keycol)

Simon

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Spockie | last post by:
I do not use linkedlist stdlibrary, vector i make my own, but i have problems with one issue, and that is checking if there are duplicates in the middle of inputing information line 294 ...
1
by: mike | last post by:
Hello all, any advice or links to pages about how to have multiple language asp pages? For example, you have a database driven website that you want customers around the world to use. How do...
5
by: Jermin | last post by:
Hi, I have a database composed of a single table composed of 2 columns, an auto-numbered ID column and a column which contains 30 million random numbers. All I want to Access to do is check the...
5
by: kevinjouco | last post by:
Hello Have searched the group for a solution to the following problem without success: Table 1 has Ref No (No Duplicates) & Min Max Value Fields ie Ref No 1 Min 1 Max 10 Ref No 2 Min 11 Max...
7
by: raddrummer | last post by:
I have a main form that has combo boxes linked to a query that outputs the results of the query to text boxes on a subform. We have a job code (naming) convention here that assigns the first 2...
2
by: oaklander | last post by:
I currently have two String variables I check to find if they are duplicates: String str1 = "red"; String str2 = "yellow"; if (str1.equals(str2)){ System.out.println("Duplicate"); }...
2
by: lostdawg | last post by:
Hi, I have a question regarding duplicate entries. Basically I have a simple database with a main table called contacts. This table has 2 fields, contactsid and contactsnum. The main form has a...
5
by: fluk | last post by:
Hi Guys, I hope someone can help me with this, because i'm getting crazy to find a good way to do that! This is what I got by querying a db. $arr1 = array("site", "description", "area1" ,...
7
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.