I need to update a DB2 table with values from a temporary table, populated from a file.
The ASTU is my student record table, the EPS_CODES is my temp table. ASTU contains about 100 fields, the only one of which I need to update is named ENGPROF. The PK is PERMNUM.
EPS_CODES has 3 fields, SCHOOL, ID and EPSCODE.
I need to populate the ASTU.ENGPROF field with the value in EPS_CODES.EPSCODE where ASTU.SCHOOLNUM = EPS_CODES.SCHOOL and ASTU.PERMNUM = EPS_CODES.ID.
The SQL I tried is:
update astu3201
set engprof = (select epscode from eps_codes where schoolnum = school and permnum = id)
which returned an error message of "During SQL processing it returned: SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=3686, COLNO=30" is not allowed. SQLSTATE=23502"
All fieldnames are unique within the tables referenced.
I'm stuck. Help please!
Andrew.
The ASTU is my student record table, the EPS_CODES is my temp table. ASTU contains about 100 fields, the only one of which I need to update is named ENGPROF. The PK is PERMNUM.
EPS_CODES has 3 fields, SCHOOL, ID and EPSCODE.
I need to populate the ASTU.ENGPROF field with the value in EPS_CODES.EPSCODE where ASTU.SCHOOLNUM = EPS_CODES.SCHOOL and ASTU.PERMNUM = EPS_CODES.ID.
The SQL I tried is:
update astu3201
set engprof = (select epscode from eps_codes where schoolnum = school and permnum = id)
which returned an error message of "During SQL processing it returned: SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=3686, COLNO=30" is not allowed. SQLSTATE=23502"
All fieldnames are unique within the tables referenced.
I'm stuck. Help please!
Andrew.