Как программно создать резервную копию таблицы с созданным столбцом идентификаторов?C#

Место общения программистов C#
Anonymous
Как программно создать резервную копию таблицы с созданным столбцом идентификаторов?

Сообщение Anonymous »


Мне нужно создать резервные копии таблиц SAP HANA программным способом с помощью .NET Core. Я использую

Код: Выделить всё

Sap.Data.Hana
package with

Код: Выделить всё

HanaBulkCopy
class.
I programmatically create the target table with generated identity column, as I cannot alter it later.
For the source tables with generated identity column,

Код: Выделить всё

HanaBulkCopy
class ignores the provided identity values and generates those in target.
When try to run a manual insert query, I got following error:

INSERT, UPDATE and UPSERT are disallowed on the generated field: cannot inser into generated identity column field ID.

I tried to run this query:

Код: Выделить всё

SET IDENTITY_INSERT MYTABLE OFF;
before insert, but getting following error:

SQL syntax error: incorrect syntax near "IDENTITY_INSERT": line 1...

Please note that I have constraints so I need to insert the IDs of the source to target as it is. And I need to have the auto generated identity behavior in the target as well.
Does anyone know how to get around this?


Источник: https://stackoverflow.com/questions/764 ... ity-column

Вернуться в «C#»