DB2 3 - Working with DDL Commands

 DDL Commands
  1.  CREATE
  2. ALTER
  3. DROP
Simple Ex:

CREATE TABLE  EMP(Empno Int, EmpName VARCHAR(10)).

How to create a table using a Cobol Batch Program?

Every SQL command should start with EXEC SQL and End with END-EXEC.


CREATE:

EXEC SQL
                  CREATE TABLE EMP( EmpNo Int, EmpName VARCHAR(10)
END-EXEC

ALTER:

EXEC SQL
                  ALTER TABLE EMP
                  ADD EMP-PHONENO  INT
END-EXEC

DROP :

EXEC SQL
                  DROP TABLE EMP
END-EXEC                 



Previous
Next Post »