Dec 16, 2005 #1 woyler Programmer Jun 20, 2001 678 US Hello all, Is there a DB2 syntax for the following type of query(not in a stored procedure)? IF EXISTS (SELECT x FROM table WHERE something = "this") UPDATE table SET ............ ELSE INSERT INTO table ........... thanks in advance, Bill
Hello all, Is there a DB2 syntax for the following type of query(not in a stored procedure)? IF EXISTS (SELECT x FROM table WHERE something = "this") UPDATE table SET ............ ELSE INSERT INTO table ........... thanks in advance, Bill
Dec 17, 2005 #2 blom0344 Technical User Mar 20, 2002 3,441 NL Nope (AFAIK), this is not an SQL query, but should be part of a stored procedure.. Ties Blom Information analyst Upvote 0 Downvote
Nope (AFAIK), this is not an SQL query, but should be part of a stored procedure.. Ties Blom Information analyst
Dec 17, 2005 #3 gregsimpson Programmer Apr 18, 2002 521 woyler, I think you're after an SQL Merge, or "UPSERT" statement. Try the following link to see if it does what you require. http://www.databasejournal.com/features/db2/print.php/10896_3322041_2 Cheers Greg Upvote 0 Downvote
woyler, I think you're after an SQL Merge, or "UPSERT" statement. Try the following link to see if it does what you require. http://www.databasejournal.com/features/db2/print.php/10896_3322041_2 Cheers Greg
Dec 19, 2005 #4 juliane26 Technical User Mar 10, 2004 207 GB MERGE exists in V8: http://publib.boulder.ibm.com/infoc...topic=/com.ibm.db2.udb.doc/admin/r0010873.htm It is brand new and came with SQL2003(?) standard Juliane Upvote 0 Downvote
MERGE exists in V8: http://publib.boulder.ibm.com/infoc...topic=/com.ibm.db2.udb.doc/admin/r0010873.htm It is brand new and came with SQL2003(?) standard Juliane