Skip to Content

Solving issues with nvarchar(max) values while replicating into SAP HANA

I want to share some knowledge when it comes to issues (NULL value errors) while replicating values from a nvarchar(max) data type from MS SQL Server into a SAP HANA replicate database.

At some point in time we recognized at a customer project that a configured replication went down while the system has been already up and running for a few weeks. We investigated the log files and found an entry like “Cannot insert NULL or update to NULL: PROPERTYNAME“.

This was rather unexpected because the source column, the column within the replication definition and the column inside the target SAP HANA database were marked with NOT NULL. The issue started to appear after new rows were inserted into the source database as the replication / subscription was already “VALID”.

We started to figure out what causes the null-value inside the INSERT statement on the HANA side. The SAP support team suggested to change the data type of the column within the replication definition but that did not change anything. After that we tried to create the replication definition in an automated way by using rs_create_repdef to see if the result differs from our handmade definition, but it doesn’t.

After a couple of days of research we figured out that there is a limitation within SAP HANA which causes this behaviour. A description within the official SAP Sybase replication server documentation pointed us to the root cause:

“To replicate LOB datatypes from the Microsoft SQL Server to SAP HANA replicate database, set the lr_partial_updates_allowed parameter to false

We gave it a try, and it seems to work well.

Note: You can check your configuration setting within the replication agent by issuing the following command: ra_config lr_partial_updates_allowed

You must be Logged on to comment or reply to a post.
  • Hi,

    Is there a way of for nvarchar(max) to be converted into an appropriate Hana data type while using smart data access and replicating with .hdbreptask?

    Thanks and regards,


    • Hi Kalyani,

      SDA/SDI is able to replicate nvarchar(max) as character large object binary (CLOB or even NCLOB) via .hdbreptask

      Best regards,


      • Hi Tobias,

        Thanks for the response.

        I am on version v1.100.19. and I have created a replication task to connect with MSSQL 2012. The column with nvarchar(max) is shown in the replication task as nvarchar(0).

        When i create a virtual table directly by right clicking on a table from my remote source, then I could see that the nvarchar(max) is converted to NCLOB but not in replication editor.

        Thanks and Regards,