SAP HANA SQL Script INSERT 

Welcome to the next tutorial explaining the usage of SAP HANA INSERT statement to insert new records into a HANA Table. This method can be applied on any table, no matter how it was created – Graphically ,by SQL CREATE or HDB Table

To start, we need the SQL editor. Click somewhere in the tree under the system so that the SQL button marked below becomes enabled. Press the button to bring up the SQL console.

SAP HANA SQL SCRIPT INSERT STATEMENT

As always, the blank console opens up.

SAP HANA SQL SCRIPT INSERT STATEMENT

INSERT Data into HANA Table

The syntax for SAP HANA INSERT statement is as below:

INSERT into VALUES (value1, value2, valueN);

Note: Always remember that refers to the table name prefixed with the schema name as well as there can be tables of the same name in different schemas.
Repeat this statement as many times as the number of rows you wish to add. As seen below, I am adding data to the CUST_REV_SQL table which is in the 0TEACHMEHANA schema. System object names like schema names, table names and field names should be wrapped in double quotes “ ” whereas as you can see below, data values that have character data types inserted MUST always be wrapped in single quotes ‘ ’ whereas number do not require any quotes at all.

SAP HANA SQL SCRIPT INSERT STATEMENT

As seen from the log below, there are no errors. This means that the data was inserted successfully.

SAP HANA SQL SCRIPT INSERT STATEMENT

Now to check if it worked

To confirm, right click on the table and click on data preview.

SAP HANA SQL SCRIPT INSERT STATEMENT

The raw data tab below confirms that the data is now present in the table.

SAP HANA SQL SCRIPT INSERT STATEMENT

And if you are wondering – Yes. It was that easy to do this. SQL for HANA is fairly simple if you understand what you are doing instead of just trying random experiments off the web. This concludes our second part of the SAP HANA customized table data load series. Be sure to check out the other two tutorials as well which are:
1. Loading flat files to SAP HANA in the Enterprise HANA section
2. Linking a CSV file to a HDBTable using HDBTI Configuration file (Recommended method) which is our next tutorial as well.

Help this website grow by sharing this document on social media by using the icons below.

Happy Learning!

 

<<Previous Tutorial                                                                                                              Next Tutorial>>

Tagged , , , , , , , , , , , , , .

104 Comments

  1. Hi Shyam,

    I have couple of questions.

    1. How to find respective CSV and HDBTI files of HDB table. In above tutorial since you created in same package its easy to find, there might be scenarios where CSV and HDBTI Files might be in different packages.

    2. How to find whether HDB table data is getting data via CSV file or via SQL Script insert statement.

    Regards,
    Arjun

Leave a Reply

Your email address will not be published. Required fields are marked *