473,830 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Multiple Rows

I'm trying to UPDATE multiple rows in a single statement. I've seen some examples but to me they don't seem to apply to my scenario. Below is my original SQL:

UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID = AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))

When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...
Nov 12 '05 #1
10 13016
"Anthony Robinison" <an*****@yahoo. com> wrote in message
news:e9******** *********@twist er.rdc-kc.rr.com...
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))

When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...
-------------------------------------------------
I suspect that the problem is in the subselect, which is returning more than
one value.
Nov 12 '05 #2
"Anthony Robinison" <an*****@yahoo. com> wrote in message
news:e9******** *********@twist er.rdc-kc.rr.com...
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))

When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...
-------------------------------------------------
I suspect that the problem is in the subselect, which is returning more than
one value.
Nov 12 '05 #3
I've seen examples where they were able to get around the more than one
record issue...

Anyone seen this or have any ideas?

"Mark A" <ma@switchboard .net> wrote in message
news:gf******** *********@news. uswest.net...
"Anthony Robinison" <an*****@yahoo. com> wrote in message
news:e9******** *********@twist er.rdc-kc.rr.com...
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))

When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...
-------------------------------------------------
I suspect that the problem is in the subselect, which is returning more than one value.

Nov 12 '05 #4
I've seen examples where they were able to get around the more than one
record issue...

Anyone seen this or have any ideas?

"Mark A" <ma@switchboard .net> wrote in message
news:gf******** *********@news. uswest.net...
"Anthony Robinison" <an*****@yahoo. com> wrote in message
news:e9******** *********@twist er.rdc-kc.rr.com...
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))

When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...
-------------------------------------------------
I suspect that the problem is in the subselect, which is returning more than one value.

Nov 12 '05 #5
Ian
Anthony Robinison wrote:
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

*/UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))/*
*//*
When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...


....
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID in (select ...)
Good luck,

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #6
Ian
Anthony Robinison wrote:
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

*/UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))/*
*//*
When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...


....
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID in (select ...)
Good luck,

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #7
I can't believe it was that easy!!! Why didn't I think of that - I was
making it way too complicated...

Thanks Ian!

"Ian" <ia*****@mobile audio.com> wrote in message
news:40******** **@corp.newsgro ups.com...
Anthony Robinison wrote:
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

*/UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))/*
*//*
When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...


...
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID in (select ...)
Good luck,

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #8
I can't believe it was that easy!!! Why didn't I think of that - I was
making it way too complicated...

Thanks Ian!

"Ian" <ia*****@mobile audio.com> wrote in message
news:40******** **@corp.newsgro ups.com...
Anthony Robinison wrote:
I'm trying to UPDATE multiple rows in a single statement. I've seen some
examples but to me they don't seem to apply to my scenario. Below is my
original SQL:

*/UPDATE AIM.AIMRetrieve dItem
SET ImageFront=NULL ,
ImageFrontSize= NULL,
ImageFrontType= NULL,
ImageBack=NULL,
ImageBackSize=N ULL,
ImageBackType=N ULL
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID = (SELECT
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID
FROM
AIM.ARCHIVERETR IEVAL,
AIM.AIMRETRIEVE DITEM
WHERE
AIM.AIMRETRIEVE DITEM.ARCHIVERE TRIEVALID =
AIM.ARCHIVERETR IEVAL.ARCHIVERE TRIEVALID
AND AIM.ARCHIVERETR IEVAL.EXPIRATIO NDATE < DATE(CURRENT TIMESTAMP))/*
*//*
When I run this query, I get the multiple recordset error.

I would welcome any suggestions or ideas on how to rectify the problem.

Thanks in advance...


...
WHERE AIM.AIMRetrieve dItem.ArchiveRe trievalID in (select ...)
Good luck,

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #9
Also take a look at the MERGE statement. It doesn't require the double
select

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #10

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

Similar topics

2
31133
by: Rima | last post by:
I have the following two tables : table a (commit_id, capital_market_id, chg_lst_date ) table b (b_seq_id,
7
248494
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a particular surname in a particular town. I can select the records fine with this syntax (testing in Oracle SQL* Plus) SELECT NAMEINFO.LASTNAME, NAMEINFO.FIRSTNAME, NAMEINFO.MIDDLENAME, NAMEINFO.GENDER, ADDRESSINFO.REGION FROM NAMEINFO, ADDRESSINFO...
8
89326
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON tblMyTable.UniqueID = tblMyTableTEMP.UniqueID SET tblMyTable.myField = tblMyTableTEMP.myField, tblMyTable.myField2 = tblMyTableTEMP.myField2,
8
8618
by: Jason | last post by:
I have a table that matches up Securities and Exchanges. Individual securities can belong on multiple exchanges. One of the columns, named PrimaryExchangeFlag, indicates if a particular exchange is the primary exchange for that symbol. Each symbol can only have one primary exchange. I am trying to write a insert/update/delete trigger that enforces this rule. The rules I have thought of are as follows: Insert If new row has flag...
18
5990
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query against a different table (that uses the LIKE predicate) but cannot get around the SQL0132 error . I have tried the hex notation after the LIKE such as (without the quotes)... " where colNewPartNum like ( X'27' || nnn.colPartNum || X'27) " ,...
2
3710
by: Christopher | last post by:
Greetings, Fairly new to c# and Im looking for pointers on a few topics: Im curious as to general methods to update multiple rows in a database. Currently Im thinking of just allowing a user to update one row of data at a time and designing/building textboxes to allow them to enter this data. I would then use a method to insert this data. (sqlCommand) Is there a more efficient method of updating 10 rows of data at a time? Such
4
4095
by: Ed L. | last post by:
I think I'm seeing table-level lock contention in the following function when I have many different concurrent callers, each with mutually distinct values for $1. Is there a way to reimplement this function using select-for-update (or equivalent) in order to get a row-level lock (and thus less contention) while maintaining the function interface? The docs seem to suggest so, but it's not clear how to return the SETOF queued_item and also...
20
18393
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
3
49562
by: spartacus | last post by:
Hi, Does SQL support update to multiple rows where values coming from a sub-query? e.g insert into TABLE1 select column1, column2, column3 from TABLE2
5
11073
by: MARIEDB2 | last post by:
Hello, I am struggling to build a query on a DB2 db wich does an update for multiple fields which are the result of a select query with where clause (using multiple tables in the condition). E.g. UPDATE TABLE_HDR SET HDRFIELD1 = 'XX' WHERE EXIST (SELECT HDRFIELD1 FROM TABLE_HDR,TABLE_1A,TABLE_1B WHERE FIELD_1A= FIELD_1B AND HDRFIELD1=FIELD1A)
0
9781
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9641
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10769
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10522
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5615
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3072
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.