sql server - SQL insert into fails using substring from same table -
sql server - SQL insert into fails using substring from same table -
i create process using substring table1.column2 , insert results table1.column6. trying query below insert fails. tries insert column (column1) id column. specify column6 not work.
insert table1(column6) select substring(column1,1,3) table1 error:
msg 515, level 16, state 2, line 1 cannot insert value null column 'column1id', table 'dbo.table1'; column not allow nulls. insert fails.
if table contain info , column6 empty (null), must utilize update command
update table1 set column6 = substring(column1,1,3) that utilize info stored table1 , update column6
sql sql-server
Comments
Post a Comment