Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Cannot insert the value NULL into column - colom is nulllable and i filter out null values

I also tried to add only 1 row and it didnt work. I also tried 

 

CREATE TABLE [GoldWH_SalesOrder].[datamart_salesOrder].[dimProduct]

(

   ind int NOT NULL,

   Item VARCHAR(6000) NULL,

   UnitPrice REAL,

   ValidFrom date,

   validUntil date

)

GO

 

 

ALTER TABLE [GoldWH_SalesOrder].[datamart_salesOrder].[dimProduct] ADD CONSTRAINT PK_product PRIMARY KEY NONCLUSTERED (ind) NOT ENFORCED;

 

 

INSERT INTO [GoldWH_SalesOrder].[datamart_salesOrder].[dimProduct]

( Item, UnitPrice, ValidFrom, validUntil)

SELECT  Item, UnitPrice, ValidFrom, ValidUntil

from [SilverWH_salesorder].[dbo].[scd2_product_view]

where Item is not NULL and UnitPrice is not NULL and ValidFrom is not NULL and ValidUntil is not NULL

 

Cannot insert the value NULL into column 'Item', table 'dimProduct'; column does not allow nulls. INSERT fails.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Can you try this and let me know the results?

INSERT INTO [GoldWH_SalesOrder].[datamart_salesOrder].[dimProduct]
(ind, Item, UnitPrice, ValidFrom, validUntil)
SELECT 1, Item, UnitPrice, ValidFrom, validUntil
from [SilverWH_salesorder].[dbo].[scd2_product_view]
where Item is not NULL and UnitPrice is not NULL and ValidFrom is not NULL and validUntil is not NULL;

It works fine in my case. 

vcgaomsft_1-1726122838174.png

 

The problem should be with the ind column, which is set to not null but does not have any value when inserted.

vcgaomsft_0-1726122732330.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

Can you try this and let me know the results?

INSERT INTO [GoldWH_SalesOrder].[datamart_salesOrder].[dimProduct]
(ind, Item, UnitPrice, ValidFrom, validUntil)
SELECT 1, Item, UnitPrice, ValidFrom, validUntil
from [SilverWH_salesorder].[dbo].[scd2_product_view]
where Item is not NULL and UnitPrice is not NULL and ValidFrom is not NULL and validUntil is not NULL;

It works fine in my case. 

vcgaomsft_1-1726122838174.png

 

The problem should be with the ind column, which is set to not null but does not have any value when inserted.

vcgaomsft_0-1726122732330.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Fabric Update Carousel

Fabric Monthly Update - September 2025

Check out the September 2025 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.