Forum Discussion
Can not insert null value error for nulllable column
- 2 years ago
Hi Anonymous
Thanks for your answer, unfortunately the column was neither primary key, foreign key or use in calculations.
Nethertheless I found a solution, or more like a workaround.
The columns in the Insert statement have been in a different order than the columns were ordered in the create table. So indeed, there were NULL values for a not null column, but it was not the one displayed in the error message, but the one that would have been in the same position in the table.
So for me that sounds like a bug.
Thx and KR Max
- Anonymous2 years ago
Hi MaxBronder ,
I have checked with the internal team. There is no active bug for such a scenario currently.
But you could share your feedback on our feedback link which would be open for the user community to upvote & comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and gives insight into the potential impact of implementing the suggested feature.
Feedback Link : Home (microsoft.com)
Thank you.
Hi MaxBronder ,
Thanks for using Fabric Community.
As I understand you are trying to insert NULL values into a table, and you are facing error eventhough the column is nullable column. I tried to repro the scenario and was successful in inserting NULL values into my Warehouse table using SSMS. I have attached the screenshots for your reference.
1) Creating a table in Warehouse:
2)Inserting NULL values into the table using Warehouse T-sql :
3)NULL values inserted into the table successfully:
4)Trying to insert NULL columns using SSMS :
5)NULL columns inserted successfully:
There are a few reasons why you might get this error:
- You are trying to insert a NULL value into a column that is defined as the primary key. Primary keys must always have a value, so they cannot be NULL.
- You are trying to insert a NULL value into a column that has a foreign key constraint. Foreign key constraints require that the value in the column must exist in the referenced table. If the value in the referenced table is NULL, then the foreign key constraint will be violated.
- You are trying to insert a NULL value into a column that is used in a calculation or other operation. If the column is NULL, then the calculation or operation cannot be performed.
Hence check for the above reasons in your case and try inserting the rows again.
Hope this helps. Do let us know if you have any further issues.
Hi MaxBronder ,
We haven’t heard from you on the last response and was just checking back to see if your issue has been resolved. Please let us know if you have any further issues.