|
Good catch...guess I shouldn't answre posts quickly before leaving for
lunch! :)
how about:
update ClientTable A
set ClientVersion = (select max(CilentVersion) + 1
from ClientTable B
where a.clientID = b.clientID)
where clientID in (select clientID from NewClientTable);
insert into ClientTable (ClientID, ClientName, ClientVersion)
(select ClientID, ClientName, 0
from NewClientTable);
Charles
On Thu, Sep 16, 2010 at 11:39 AM, Morgan, Paul <Paul.Morgan@xxxxxxxxxxx>
wrote:
Charles,ClientVersion = 0 and the ClientID is in the transaction table. Odd but
He wants to set ClientVersion to 1 + Max(Clientversion) when
that's what he wants. Your Update bumps up the client version in all the
records.
midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Paul
Principal Programmer Analyst
IS Supply Chain/Replenishment
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:
Sent: Thursday, September 16, 2010 11:28 AMwrote:
To: Midrange Systems Technical Discussion
Subject: Re: Can I replace RPG with SQL?
Assuming ClientID is unique in both tables....
update ClientTable
set ClientVersion = ClientVersion + 1
where clientID in (select clientID from NewClientTable);
insert into ClientTable (ClientID, ClientName, ClientVersion)
(select ClientID, ClientName, 0
from NewClientTable);
HTH,
Charles
On Thu, Sep 16, 2010 at 9:44 AM, David FOXWELL <David.FOXWELL@xxxxxxxxx>
maybe.....I don't think this is easy enough to make it worthwile with sql, but,
clientId 15 becomes 'Smith'. But I can't just update the client file from
Here's my client file that I want to update :
ClientId ClientName ClientVersion
15 Bigs 0
I receive a file containing clientId and the new name of the client, eg,
this work file. I need to archive the original name, so I have this kind of
representation after the update :
updated to n+1 and a new line is written to the file. So, in the example,
ClientId ClientName ClientVersion
15 Smith 0
15 Bigs 1
There's a timestamp field among the other fields. Version 0 is always
I've updated the line Bigs and I've written the line Smith.
now to 'Eggs', I want to see :
So, version 0 is the current version and 1 is the old one. If I change
clients at a time. I'm having to use an RPG to write to the client file, but
ClientId ClientName ClientVersion
15 Eggs 0
15 Bigs 1
15 Smith 2
I ask because I get this request now and again, for a few thousand
I always end up using SQL to prepare a work file for that RPG.
list
Thanks.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
listTo post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxlist
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.