cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Hana Cloud: Database Error: Cannot Insert Null or update to Null

Rakesh_Kr
Participant
0 Kudos

Hi Experts,

We are facing the db error "Database Error: Cannot Insert Null or update to Null" when trying to deploy the db changes in cloud foundry space. Please note that there is already a previous version which is in production and now as a new change we added a new field in db which is a primary key. I understand the issue is because of this new field being primary key as its expecting some value and can't accept null.

However we can't pass any default values to this field and need this as a primary key. Do we have any way to handle this situation without deleting the already deployed instances. (as productive db data will be lost).

Please suggest!

Thanks,

Rakesh

junwu
Active Contributor
0 Kudos

you can't pass default value or you don't know how to pass?

Accepted Solutions (0)

Answers (1)

Answers (1)

Dinu
Contributor
0 Kudos

Deployment will try to insert the existing records into the table with the new field as primary key. This is bound to fail.

I guess, since you added a new primary key, the old content is not relevant. If so delete the content before deployment. If the content is relevant you will need to migrate the content; how do you plan to create primary keys for the existing rows?