473,387 Members | 1,687 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,387 software developers and data experts.

Enter into database only new values found in the SQL statement, skip the ones already

How can i write SQL INSERT IntO Statement that will add in the database only new values in the database, and skip the ones already in the database?

Thanks
Nov 8 '11 #1
1 1737
Maraj
24
Try this may it work for you
Expand|Select|Wrap|Line Numbers
  1.  
  2. insert into new database.dbo.table_name select * from old database.dbo.table_name where
  3.  old database.dbo.table.Primary Key not in 
  4. (select  new database.dbo.table.Primary Key from  new database.dbo.table) 
  5.  
Nov 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: serge | last post by:
How can i enter Default Values of " " to all the columns of type character of all the tables (excluding system tables) and Default Values of 0 of all columns of type numbers. Excluding all primary...
7
by: narshe | last post by:
I haven't come across an elegant way to do this yet, and would like to know what other people have come up with. There are two tables: CREATE TABLE EmployeeStatus ( pkId int not null primary...
0
by: Lavs | last post by:
Hi Guys... Is there anyone who could help me on how to add an image file to a database using SQL Statement... I am using a database in MS ACCESS 2003, and my application was designed in VB 6.0. I...
1
by: CPP amateur | last post by:
Default arguments are those arguments that are substituted for the missing arguments in the function call. Is it possible to enter default values, instead of providing them in the function prototype...
1
by: katta.naveenkumar | last post by:
Hi friends My name is naveen kumar katta .My task is insert database values to pdf template with editable mode plz help me frieds.using ASP.NET I am giveing ex: step 1:
1
by: n3ox3ro | last post by:
If im using an "enter parameter values" box in a query to find information in a table and if you type in a value that doesnt exist how do you stop if from displaying a blank screen on your form??
1
by: phanimadhav | last post by:
actually i want to present the sqlserver values to pdffile and HTML Formats. Actually i did the database values presented in XML format.But i don't know how to present the database values to PDF and...
1
by: rose1 | last post by:
In C#.net (windows Application) enter the values directly in MSFlegrid in Runtime using C#.net
5
by: awmantonio | last post by:
I am trying to make a report which gets its data from a windows form's textboxes. My code works fine but upon display of the report, a window always appear asking to enter parameter values. How can I...
0
by: Sumprit Purabi | last post by:
Hi, everyone. I am using java swing. Till now I could able to display database values in a JTable by executing a query. Now, what i needed is that i have to place two buttons(PREVIOUS,NEXT) one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.