Defining a temp-table like another table with extra fields a

Posted by gabriel.knauth on 13-Sep-2016 18:03

Does anyone know of a way to define a temp-table like another table, but with the extra fields at the beginning?

Example:

DEFINE TEMP-TABLE ttCustomer LIKE CUSTOMER
  FIELD Active AS LOGICAL.

Active would be placed after all the CUSTOMER table fields in the temp-table. 

Is there any way to place it before all the CUSTOMER table fields in the temp-table?

Posted by Ken McIntosh on 13-Sep-2016 18:58

Hi Gabriel,

I don't think this is possible.  In fact, when working with dynamic temp-tables it is a strict requirement that CREATE-LIKE be the first method after the temp-table is created, thus explicitly disallowing using LIKE before adding any additional fields.

Regards,

Ken McIntosh

Posted by Tim Kuehn on 13-Sep-2016 19:58

Only if it's done entirely dynamically....

All Replies

Posted by Ken McIntosh on 13-Sep-2016 18:58

Hi Gabriel,

I don't think this is possible.  In fact, when working with dynamic temp-tables it is a strict requirement that CREATE-LIKE be the first method after the temp-table is created, thus explicitly disallowing using LIKE before adding any additional fields.

Regards,

Ken McIntosh

Posted by Tim Kuehn on 13-Sep-2016 19:58

Only if it's done entirely dynamically....

Posted by Richard.Kelters on 14-Sep-2016 05:11

Why do you need the field at the beginning?

Posted by gabriel.knauth on 14-Sep-2016 17:08

We have a data integrity issue in one of our large tables (many columns and many, many records).  Business has requested an extract with some analysis columns at the beginning.

I was simply wanting a shortcut - easiest to add them to the end and manipulate in Excel at this stage.

This thread is closed