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 http://connect.microsoft.com/SQLServer/feedback/details/566359/bulk-insert-silently-inserts-empty-string-for-last-column-when-it-is-not-nullit 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.
Product Language
Version
Category
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Platform
Virtualization
Please wait...