I am trying to read table data from mssql database and I want to send data to postgresql. So I have taken database Scope to open database connection then using execute query i am reading data from table “api_test” and storing it to data1. Now Again I have open the database connection for Postgresql and trying to insert data1 into Pgsql table “api_test1” using Update from datatable". but I am encountering error which i have mentioned above. Can any one help me to understand the approach to get it work???
DataTable is transactionel. IT keeps track on what was added, updated and removed, and use that toward the database …
The idea being you get some data from a SQL Server, and all the changes you make to your local copy can then be “syned” to the database using Update From DataTable.
When you get the rows to start with, those will be in “un modifyed” state, so if you try and commit those to another SQL server, nothing will happen. You can use “SetAllRowsState” to set all rows state to “Added” to get them inserted in the other SQL server table.
Now, that is not your issue here, the error simply means that the primary key used when getting the datatable does not exists on the table you are trying to insert into.
I cannot help you with 3rd party tools/applications, so you will need to consult the Postgreesql dokumentation on how to create a primary key ( also called clustered index on MSSql )