Robbin
Robbin

Reputation: 3

insert values in the last column for my table from another table

Hi I'm trying to insert values in the last column for my table from another table but am getting error ERROR:

null value in column "name" violates not-null constraint DETAIL: Failing row contains (ddf1caf0-26c2-49e1-8a73-64227eae1f50, null, null, null, null, null, 2532).

enter image description here

Upvotes: 0

Views: 596

Answers (2)

forpas
forpas

Reputation: 164139

I suspect that you want to update the column subsystem of the table software_instances with values of the column sub of the table temp_subsystem:

update software_instances si
set subsystem = ts.sub
from temp_subsystem ts
where ts.module = si.module

Upvotes: 0

upog
upog

Reputation: 5531

there are two solutions to this issue

  1. make sure the value you are selecting have the name value populated. Add where name!=null in the select query

or

  1. alter the software_instance table , to accept null values for name column.

    ALTER TABLE SOFTWARE_INSTANCES ALTER COLUMN NAME DROP NOT NULL

Upvotes: 0

Related Questions