Cannot insert the value NULL into column '', table column does not allow nulls. INSERT fails.Failed to execute following SQL block
sql-server-2008, t-sql
Solution
Check the table for columns that do not allow nulls
Either the value of one of those columns is null or you are not passing that column at all. If you have a column that is not null in not in the list of columns then the insert will fail in this manner.
Problem
I am getting following error when i execute following command. Can someone please help! Cannot insert the value NULL into column '', table column does not allow nulls. INSERT fails.Failed to execute following SQL block ``` BEGIN Select @v_setting_val=setting_val from EGPL_PROGRAM where setting_id=@v_setting_id and group_id = (select group_id from egpl_pref_group where group_type = 'departmental' and department_id=@v_department_id) INSERT INTO EGPL_PROGRAM (GROUP_ID, SETTING_ID, SETTING_VAL, IS_PREFERENCE, MODIFIER_ID, MODIFIED_DATE) VALUES (@v_group_id, @v_setting_id, @v_setting_val,'n',1,getdate()); PRINT('Inserted the following value for group ' + convert(nvarchar, @v_group_id )) PRINT('Setting_id : ' + convert(nvarchar, @v_setting_id) + ' setting_val : ' + @v_setting_val) END ```