Troubleshooting
Problem
An empty string is not a NULL value in DB2, but getting the follwing error during insert of an empty string into a NOT NULL column. SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=5, COLNO=0" is not allowed. SQLSTATE=23502
Symptom
C:>db2 "create table t2(col1 varchar(20) not null)"
DB20000I The SQL command completed successfully.
C:>db2 "insert into t2 values('')"
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2,TABLEID=5, COLNO=0" is not allowed. SQLSTATE=23502
Log InLog in to view more of this document
Was this topic helpful?
Document Information
More support for:
Db2 for Linux, UNIX and Windows
Software version:
9.7, 9.5, 10.1, 10.5, 11.1
Operating system(s):
AIX, HP-UX, Linux, Solaris, Windows
Document number:
518745
Modified date:
01 May 2025
UID
swg21689789