Home Dashboard Directory Help

Inaccurate text NULL handling in the topic for BULK INSERT by Erland Sommarskog


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 767171
Opened: 10/12/2012 5:29:31 AM
Access Restriction: Public
User(s) can reproduce this bug


The topic for BULK INSERT says (in the section for CHECK_CONSTRAINTS):

UNIQUE, PRIMARY KEY, and NOT NULL constraints are always enforced.

However, this is not accurate. For a string column that is NOT NULL, BULK INSERT inserts a blank string when there is no value in the text file (see the repro below). This is different from BCP, which raises an error in this case.

BULK INSERT has always behaved this way, so changing it seems out of the question. And in
it says that the behaviour is by design.

However, the behaviour should be discussed in the topic, and also suggest workarounds if you desire to have an error if there is no value in the input file.

Sign in to post a comment.
Posted by Microsoft on 7/18/2013 at 3:43 PM
The topic has been updated to accurately reflect the NOT NULL behavior. The 2012 topic will be published the week of July 23, 2013. The 2014 topic will be published in a few months.

Kind regards,
Gail Erickson
Posted by Microsoft on 10/26/2012 at 12:51 PM
Hi Erland,
Thank you for posting this issue. I'll review with the PM and update the topic as needed.

Gail Erickson
SQL Server Documentation team
Sign in to post a workaround.