× 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.



It doesn't help with changing data types and lengths. It helps with renaming a column. You know for those cases where you need to do database refactoring where an inappropriate name was chosen on day 1 of the system, but the database evolved and a new name is more appropriate.


-----Original Message-----
From: Rob Berendt [mailto:rob@xxxxxxxxx]
Sent: Monday, March 7, 2016 9:45 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: RE: Rename column in SQL?

Just how much of a column are you allowed to alter?
Realizing that I'm just too stressed to RTFM right now.
Like, can you change the size of a primary key constraint column from 15 char to 25 char?

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: Matt Olson <Matt.Olson@xxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 03/07/2016 09:59 AM
Subject: RE: Rename column in SQL?
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



That's a good idea! That would take care of the permissions issue and
identity column issue. The constraint issue still remains if that column
was included in a constraint.

Hope the feature request to add ALTER RENAME capability like standard DB2
gains steam. Will definitely save the developer time in these scenarios if
it is implemented.

-----Original Message-----
From: Rob Berendt [mailto:rob@xxxxxxxxx]
Sent: Friday, March 4, 2016 6:52 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: RE: Rename column in SQL?

Instead of having to recompute all the security, identity attributes, etc.

You should have tried this.
Create a new table with just the desired column (both names right) and an
integer.
Copy just the existing column's data, and the value of that row's identity
column to this new table.
alter the original table dropping this column alter the original table
adding the column back with the right names.
copy the data back from the temporary table.

If both the long name, and the short name, were wrong you might have been
able to shave down a step but since one was right the complicated it just
a little.


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: Matt Olson <Matt.Olson@xxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 03/03/2016 04:17 PM
Subject: RE: Rename column in SQL?
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



Nevermind. It's 2016 and apparently like many things it isn't available on

IBM i.

http://requirements.common.org/powerbase/view/ideasIBM.htm?db=ideasIBM&Where=ID%20=%20295



Sigh.

Guess I have to spend several hours doing a rename instead of 5 seconds to

script the permissions, triggers, constraints, create new table,
deactivate identity column, migrate data from old table to new table,
reactivate identity column, drop old table, do a rain dance.

-----Original Message-----
From: Matt Olson [mailto:Matt.Olson@xxxxxxxx]
Sent: Thursday, March 3, 2016 3:07 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: Rename column in SQL?

I'm trying to rename a column, simple task I know. But for some reason the

following syntax is not working:

ALTER TABLE APPLICATIONS RENAME COLUMN PASSWORDHISTORYENABLED TO
PASSWORDHISTORYENABLED FOR PASSHISTEN;

I wish to rename the column (long name is PASSWORDHISTORYENABLED and is
staying the same), just trying to fix the "System Name" which is unique to

IBM I's flavor of DB2 and set it to PASSHISTEN (10 character limit).

Thoughts?

--
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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.