Prevent Django from updating identity column in MSSQL
问题 I'm working with a legacy DB in MSSQL. We have a table that has two columns that are causing me problems: class Emp(models.Model): empid = models.IntegerField(_("Unique ID"), unique=True, db_column=u'EMPID') ssn = models.CharField(_("Social security number"), max_length=10, primary_key=True, db_column=u'SSN') # Field name made lowercase. So the table has the ssn column as primary key and the relevant part of the SQL-update code generated by django is this: UPDATE [EMP] SET [EMPID] = 399, ....