Need a command to insert columns in a table

IBM's flagship relational database management system
User avatar
hakghen
Posts: 59
Joined: Thu Sep 11, 2008 8:15 pm
Skillset: Junior level on z/OS basic tools, DB2, CICS and WebSphere MQ. Also some knowledge on JCL, REXX, Assembler and some other programming languages.

I also know how to make a good coffee and fry eggs, lol =P
Referer: Google
Contact:

Need a command to insert columns in a table

Postby hakghen » Sat Nov 08, 2008 3:21 am

Hello friends,

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

Code: Select all

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

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Need a command to insert columns in a table

Postby dick scherrer » Sat Nov 08, 2008 4:34 am

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.
Hope this helps,
d.sch.

User avatar
hakghen
Posts: 59
Joined: Thu Sep 11, 2008 8:15 pm
Skillset: Junior level on z/OS basic tools, DB2, CICS and WebSphere MQ. Also some knowledge on JCL, REXX, Assembler and some other programming languages.

I also know how to make a good coffee and fry eggs, lol =P
Referer: Google
Contact:

Re: Need a command to insert columns in a table

Postby hakghen » Sat Nov 08, 2008 4:41 am

Hmm... I see... Thanks Dick! :D
[]'s,

Hakghen

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Need a command to insert columns in a table

Postby dick scherrer » Sat Nov 08, 2008 5:39 am

You're welcome - good luck :)

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


  • Similar Topics
    Replies
    Views
    Last post