Thursday 14 September 2017

SAP HANA: How to copy tables from one schema to another schema in SAP HANA?


  1.       How to create a new table based on the existing table in another schema without data i.e., only the structure of the table?

SYNTAX:

create column table "New_Schema_Name"."New_Table_Name" like "Old_Schema_Name"."Old_Table_Name";

CODE:


create column table "KABIL"."EMPLOYEE_SAMPLE" like "KABIL_PRACTICE"."EMPLOYEE_SAMPLE";

RESULT:



2. How to create a new table based on the existing table in another schema with data?

SYNTAX:

create column table "New_Schema_Name"."New_Table_Name" as ( select * from "Old_Schema_Name"."Old_Table_Name");

CODE:

create column table "KABIL"."EMPLOYEE_SAMPLE" as ( select * from "KABIL_PRACTICE"."EMPLOYEE_SAMPLE");

RESULT:


1 comment:

  1. This was really good and could you please explain how to replicate entire schema along with data from one to another?

    ReplyDelete