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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Hennie1234
Frequent Visitor

INSERT fails with a subset of columns when columns are NULL

Hi,

 

I think it is a bug when I try to insert data with INSERT statement in a table in Synapse data warehouse

 

 

insert titles (title_id, title, type, pub_id, notes) values('PC9999', 'Net Etiquette',
'popular_comp', '1389', 'A must-read for computer conferencing.')
GO

This will give an error

 

Msg 15806, Level 0, State 1
Cannot insert the value NULL into column 'ytd_sales', table 'titles'; column does not allow nulls. INSERT fails.

 

 

DROP TABLE IF EXISTS titles;

CREATE TABLE titles
(
title_id varchar(80),
title varchar(80) NOT NULL,
type char(12) NOT NULL,
pub_id char(4) NULL,
price DECIMAL(7,2) NULL,
advance DECIMAL(7,2) NULL,
royalty int NULL,
ytd_sales int NULL,
notes varchar(200) NULL,
pubdate datetime2(0) NOT NULL
);

1 REPLY 1
HimanshuS-msft
Microsoft Employee
Microsoft Employee

Hello  @Hennie1234 

Thanks for using the Fabric community .

I think I have a repro and I think the error message with to be corrected . 

The correct message should be
Error message : Cannot insert the value NULL into column 'pubdate ', table 'titles'; column does not allow nulls. INSERT fails.

I am woerking with the internal team to get this fixed .

As I workaround in your case either update the below 
pubdate datetime2(0) NULL

OR
pass the pubdate  in the INSERT statement . 

 

Thanks
HImanshu

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

June FBC25 Carousel

Fabric Monthly Update - June 2025

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