title: Django cannot insert duplicate key value NULL
body: <p>I need to allow NULL in <code>enc_id</code>, but if values are not null, I need those values to be unique. Here's my model:</p>
  
  <pre><code>class Intake(models.Model):
      id = models.AutoField(primary_key=True)
      enc_id = models.IntegerField(blank=True, null=True, unique=True)
      enc_date = models.DateField(null=True)
      enrollment = models.ForeignKey('Enrollment')
  </code></pre>
  
  <p>Error when trying to add another instance without an <code>enc_id</code>:</p>
  
  <pre><code>django.db.utils.IntegrityError: ('23000', "[23000] [FreeTDS][SQL Server]Violation of UNIQUE KEY constraint 'UQ__caseload__E136D21F4222D4EF'. Cannot insert duplicate key in object 'dbo.caseload_intake'. The duplicate key value is (&lt;NULL&gt;). (2627) (SQLExecDirectW)")
  </code></pre>
  
  <p>According to what I've read (including <a href="https://stackoverflow.com/questions/454436/unique-fields-that-allow-nulls-in-django">this</a> and a few resolved Django issues), having <code>blank=True, null=True, unique=True</code> should allow me to have duplicate NULLs, but no go. I've recreated my DB just in case and it still raises the integrity error. </p>
  
  <p>I'm running Django 1.10 and MS SQL Server 10. Any ideas? </p>