× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Charles,

Depending on whether fields / columns are made smaller or removed, you
will also need to worry about ensuring that message ID CPA32B2 is answered
"I" automatically.

We did it by temporarily changing the job to be INQMSGRPY(*DFT) and
overriding the QCPFMSG message file to a special one with that message
changed to have its default to be "I".

Regards,

Kevin Wright

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Charles Wilt
Sent: Thursday, 17 October 2019 6:46 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Utility to compare structure of two tables and generate an
ALTER TABLE

I'd forgotten about the OR REPLACE with DATA on the create table...

That might do the trick..

Actually the two tables in question are the same table, just one is a
newer
version.

I'm looking at something better than having developers script the ALTER
TABLE..

Charles

On Wed, Oct 16, 2019 at 12:40 PM Mark Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:

Hi, Charles,


I talked with Scott Forstie, at COMMON, several years ago, about this
very
idea. What I wanted and asked for was something like:

ALTER TABLE ... LIKE some other table

similar to what ORACLE and several other database have done. ;-)

When I talked to Scott forstie about it, he then told me about the
then-new feature of Db2i SQL where you can now do:

CREATE OR REPLACE TABLE (or VIEW etc.) ... WITH DATA.


So, what you could do is retrieve the SQL DDL using that API, or one of
those newfangled "services" (UDTFs, or UDFs, see Rob's reply), for the
new
target file, the one that looks the way you want it to look, then just
do
the following:

#1. edit that source so that it now matches the name of the original
table
(library/filename) you want to CREATE OR REPLACE

#2. insert the "OR REPLACE" into that generated CREATE statement

#3. add the appropriate "WITH DATA" clause on the end

#4. save it

#5. run it using iACS or RUNSQLSTM etc.


"and Bob's your uncle!"


What do you think? :-)


All the best,


Mark S. Waterbury






On Wednesday, October 16, 2019, 1:41:48 PM EDT, Charles Wilt <
charles.wilt@xxxxxxxxx> wrote:





Anybody ever run across a utility that would compare two tables and
generate the necessary ALTER TABLE command to make the second table look
like the first?

Basically, looking for the SQL equivalent of CHGPF SRCFILE()...

Thanks!
Charles
--

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.