IBMi (AS400) fans only : RUNSQLSTM Run SQL Scripts example
#IBMiSample
The Run SQL Statements (RUNSQLSTM) command processes a source file of Structure Query Language (SQL) statements.
let's have an example:
Create a source member AS52A00F into library VDOTEST1/QSQLSRC.
VDOTEST1 is MyLibrary. Use your library name.
AS52A00F.SQL
CREATE OR REPLACE TABLE VDOTEST1/AS52A00F (
A1IDNM NUMERIC(9, 0) GENERATED ALWAYS AS IDENTITY,
A1ORIN TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP,
A1ORCR TIMESTAMP GENERATED ALWAYS FOR EACH ROW ON UPDATE
AS ROW CHANGE TIMESTAMP NOT NULL,
A1FANN CHARACTER(1) NOT NULL WITH DEFAULT,
A1FLD1 CHARACTER(6) NOT NULL WITH DEFAULT,
A1FLD2 CHARACTER(6) NOT NULL WITH DEFAULT,
A1FLD3 CHARACTER(6) NOT NULL WITH DEFAULT,
A1TIPF CHARACTER(1) NOT NULL WITH DEFAULT);
Then run:
RUNSQLSTM SRCFILE(VDOTEST1/QSQLSRC) SRCMBR(AS52A00F)
What you get is a table created using SQL instead of the "old" DDS
That's it.
I appreciate all the comments made on this blog.
Comments
Post a Comment