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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 767171 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/12/2012 5:29:31 AM
Access Restriction Public


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