Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--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
You can’t perform that action at this time.