Last active
October 5, 2016 12:00
-
-
Save phpdave/60b755b20c77d06b5717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Create backup | |
CREATE TABLE MYLIB.MYTABLEBACKUP | |
AS (SELECT * FROM MYLIB.MYTABLE) | |
WITH DATA; | |
--::WARN:: This will tell the server to drop columns even if there is data in the column | |
CALL QSYS2.QCMDEXC('ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY(''I'')'); | |
CALL QSYS2.QCMDEXC('CHGJOB INQMSGRPY(*SYSRPYL)'); | |
--Alter table, drop column and add column | |
ALTER TABLE MYLIB.MYTABLE DROP COLUMN OLDCOLUMNNAME ; | |
ALTER TABLE MYLIB.MYTABLE ADD COLUMN NEWCOLUMNNAME CHARACTER (1) ; | |
--Pull the data back in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment