cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO CREATE A TABLE SAME AS OTHER TABLE

Former Member

Hi

I want to create a table same structure as MARA ..

so how to create a table .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you want to copy table A, in SAP HANA, you just have to:

CREATE COLUMN TABLE "NAME_TABLE_B" LIKE "NAME_TABLE_A" WITH DATA;

And that's it.

If you don't want to preserve the information: CREATE COLUMN TABLE "NAME_TABLE_B" LIKE "NAME_TABLE_A";

Former Member
0 Kudos

Thanks Jose ..If I want only selected field then .. any syntax is there..

lbreddemann
Active Contributor
0 Kudos

Surya,

please do your share of documentation research before you post your questions here.

Normally this whole thread would be a "failed to search" case and I would moderate it.

Since some users already put in effort to help you, I will only block this thread this time and provide them with a "helpful answer" reward.

Please do consider before posting new questions and make sure that you look for existing information beforehand.

- Lars

Answers (2)

Answers (2)

former_member200930
Participant
0 Kudos

Hi Surya,

please check following options

  1. create same table structure

         create column table <<new_Table_name>> as

          (

          select top 0 * from <<Schema_Name>>."MARA"

          );         

   2. create same table structure with complete records

      create column table <<new_Table_name>> as

          (

          select * from <<Schema_Name>>."MARA"

          );

     3. create column table "NEW_MARA" like "<<SCHEMA_NAME>>"."MARA";

I hope, this will help you.

Regards,

Vikram Divekar

former_member183326
Active Contributor
0 Kudos

Hello Surya,

If you want to find the SQL that creates the Table, go to the MARA Table,

Right click on this > Open Definition.

On the top right of the HANA Studio you can click on "Export SQL"

This will open the SQL Editor with the SQL used to create the MARA Table. You can try using this SQL for the structure.

BR

Michael

Former Member
0 Kudos

thanks a lot ..Michael..

can we create any similar way like ABAP

it_ra_const  TYPE RANGE OF zbw_const_value ...