cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

One or more rows contain values violating non-null, unique, or foreign-key constraints.

mta1
Explorer
0 Kudos
333

We execute SELECT statements in our .NET 8.0 app via the ODBC driver on HANA systems and receive the error message mentioned in the subject line.

Characteristics of the affected system:
- SAP Business One 10.0 version for SAP HANA (10.00.260) SP 2408 (64-bit)
- HDBODBC (64-bit) 2.20.22.39682

The problem only occurs when SAP fields are retrieved that have the data type NVARCHAR(1) with a default value. For example: OWHS.Locked
SELECT "Locked" FROM "OWHS"

The problem no longer occurs for these fields if their data type is changed via the CAST command, e.g. to VARCHAR(1).
SELECT CAST("Locked" AS VARCHAR(1)) FROM "OWHS"

In all other systems that are equipped with older SAP Businnes One and HDBODBC versions, this problem does not occur.

Our workaround:
Disable the observance of constraints, .NET-Code:
DataSet dataSet = new DataSet { EnforceConstraints = false };
DataTable result = dataSet.Tables.Add();
ExecuteOnDbCommand(command, commandAction => result.Load(commandAction.ExecuteReader()), setSchemaContext);
return result;

Accepted Solutions (0)

Answers (0)