1. Michael Manfre
  2. django-mssql
  3. Issues


Issue #53 resolved

Inspectdb with type varchar(max) will set max_length to 2147483647

created an issue

A field of MSSQL type varchar with length max will convert to a python field of type models.CharField with max_length=2147483647 (on 32-bit python).

This behavior breaks subsequent runs of syncdb. MSSQL will complain:

DatabaseError: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Native Client 10.0', u"The size (2147483647) given to the column 'EMAIL' exceeds the maximum allowed for any data type (8000).", None, 0, -2147217900), None)

I'm guessing it's server dependent. However, sometimes it says the max is 8000, sometimes 4000, even on the same server with seemingly the same field configurations.

Not sure what the ideal solution would be since the max_length parameter expects a positive integer, so 'max' cannot be passed in.

Comments (4)

  1. Log in to comment