I want to write back changes to a MSSQL database after reading information from a table.
The table is designed to provide a minimum working example and has two columns:
- ID: ID column starting with 1, increments with 1
- VALUE: column containing integer values.
I have managed to read from this database table, however, I want to be able to change a value in AIMMS and then write back the change using
write p_parameter(i_ID) to table db_TableName;
However, this gives me an error stating that I'm not allowed to insert manally into an ID column. This makes sense of course, but how do I prevent AIMMS from trying to insert into the ID column and replace old values by new ones instead?
Best answer by Chris Kuip
Sorry, I didn't have a MS SQL ready to test with, that is why I used MySQL.
Would you mind trying the following:
block where database_foreign_key_handling := 'assume',
database_string_valued_foreign_keys := 'assume' ;
write to table db in replace mode ;
The idea is that you force AIMMS to use a different writing strategy, see https://how-to.aimms.com/Articles/343/343-use-metadata-in-write-to-table.html
Hope this works,