Replicating XML data from a source into SAP HANA Table

1.8k views Asked by At

I have been asked this question many times that how can I replicate data from a source with XML format into HANA tables.

I have actually done the opposite of it i.e. converting data from HANA CV into XML Format using XSJS.

But not sure if the above is possible i.e.to load data from a source with XML format Data to HANA using XSJS.

please provide if there is any document on this.

Thanks,

Sarthak

2

There are 2 answers

2
Florian Pfeffer On

Smart Data Integration provides XML connectors to easily integrate XML data into HANA. As you explicitly asked for XSJS (which means you wanna go the "hard" way), you can use in XS Classic the $.util.SAXParser library for parsing your loaded XML. The same library can be used for XS Advanced in a Node module with XSJS compatibility, but on XSA I would prefer to use one of the many free available XML libraries either for Node or Java.

0
Eralper On

If you want to insert XML into a HANA database table you can use following SQL Insert statement

First create the database table including a column with data type nvarchar

Then execute INSERT command

create column table XMLData (
    id integer, 
    xml nvarchar(5000)
);

insert into XMLData (id,xml) values (1,N'
-- your xml here
');