Page 1 of 1

Need a command to insert columns in a table

PostPosted: Sat Nov 08, 2008 3:21 am
by hakghen
Hello friends,

I'm doing some tasks on a mainframe training, and I had to create the following table into the SPUFI:

CREATE TABLE ZCON039.EMPLOYEE
(EMPNO CHAR(6) NOT NULL,
FORENAME CHAR(20) NOT NULL,
INITIAL CHAR(1),
SURNAME VARCHAR(50) NOT NULL,
SEX CHAR(1) NOT NULL,
DOB DATE,
TELEPHONE CHAR(6),
DATE_HIRED DATE,
JOB CHAR(20),
SALARY DECIMAL(9,2),
BONUS DECIMAL(9,2),
COMMISSION DECIMAL(9,2),
DEPTNO CHAR(3),
LOCID CHAR(10),
PRIMARY KEY(EMPNO),
FOREIGN KEY (DEPTNO)
REFERENCES DEPARTMENT(DEPTNO) ON DELETE NO ACTION,
FOREIGN KEY (LOCID)
REFERENCES LOCATION(LOCID) ON DELETE NO ACTION)
IN SMDB039. SMTS039;


However, while creating, I forgot to insert the following columns: FORENAME, INITIAL and SURNAME. What is the command (or sql statement) that I should use now to insert these columns? I was thinking of trying the ALTER TABLE one, but I don't know if it will work.

[]'s, thanks in advance,

Andre

Re: Need a command to insert columns in a table

PostPosted: Sat Nov 08, 2008 4:34 am
by dick scherrer
Hello,

Probably easiest to drop and re-create the table. Certainly more straight forward.

Then you will have a complete set of create syntax for use later rather than having your table definition fragmented. As it happens, tables do get dropped and re-created with some regularity.

Re: Need a command to insert columns in a table

PostPosted: Sat Nov 08, 2008 4:41 am
by hakghen
Hmm... I see... Thanks Dick! :D

Re: Need a command to insert columns in a table

PostPosted: Sat Nov 08, 2008 5:39 am
by dick scherrer
You're welcome - good luck :)

d
ps. if the table currently has data you want to preserve, unload the data first for later reload.