Return to the RPG Tips
Embedded SQL to create a table based on the description of another table
H OPTION(*NOSHOWCPY:*NOEXPDDS:*NODEBUGIO:*SRCSTMT) H DATFMT(*ISO) TIMFMT(*ISO) H CVTOPT(*NOVARCHAR:*NODATETIME) H THREAD(*SERIALIZE) H BndDir('QC2LE') H DftActGrp(*NO) /Free Exec SQL CREATE TABLE library/temptable as ( SELECT * FROM library/tablename ) DEFINITION ONLY INCLUDING IDENTITY INCLUDING COLUMN DEFAULTS ; If SQLCOD <> -601 ; // Table already exists EndIF ; *INLR = *On ; /End-free
[report a broken link by clicking here]