Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / July 2006

Tip: Looking for answers? Try searching our database.

DB2 SQL insert question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kaming - 12 Jul 2006 08:29 GMT
Dear all,

I know that we could insert data from a table to another table by

insert into A(F1,F2) select F1,F2 from B;

However, it seems that DB2 doesn't have insert update for this kind of
statement (i.e. The insertion failed if primary key already exist in A,
while we could do this in import statement)

Is that I missed something from the manuel? The work around I think of
is to delete the records beforehand, could anyone tell me whether this
could be done in the same statement?

Thanks in advance!

Henry
mike - 12 Jul 2006 08:40 GMT
Consider " Insert into...select ... from... where not exists ...."
or the MERGE statement might help you, if available on your platform
and version.
Gert van der Kooij - 12 Jul 2006 08:46 GMT
> Dear all,
>
[quoted text clipped - 13 lines]
>
> Henry

Check the MERGE statement at http://tinyurl.com/o2hxe
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.