admin管理员组

文章数量:1316974

I migrated a database to an Azure SQL Server Managed Instance. When I try to do a SELECT on a specific column, I get this error:

Invalid Field Size

The column is defined as VARCHAR(MAX).

I get no error if:

  • I query Azure SQL Server MI via SSMS (20.2)
  • I query the old on premise database via SSMS (20.2)
  • I query the old on premise database via ODBC Driver 17 for SQL Server
  • I query the old on premise database via SQL Server Native Client 11.0 (v. 2011.11)

Any of the ODBC driver with Azure end up errorring out for that specific column.

The ODBC drivers are 32 bit. Application using them need it like that.

I migrated a database to an Azure SQL Server Managed Instance. When I try to do a SELECT on a specific column, I get this error:

Invalid Field Size

The column is defined as VARCHAR(MAX).

I get no error if:

  • I query Azure SQL Server MI via SSMS (20.2)
  • I query the old on premise database via SSMS (20.2)
  • I query the old on premise database via ODBC Driver 17 for SQL Server
  • I query the old on premise database via SQL Server Native Client 11.0 (v. 2011.11)

Any of the ODBC driver with Azure end up errorring out for that specific column.

The ODBC drivers are 32 bit. Application using them need it like that.

Share Improve this question edited Jan 29 at 21:02 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Jan 29 at 20:35 JcHamJcHam 1 1
  • have you tried with latest driver? – Pratik Lad Commented Feb 3 at 10:10
Add a comment  | 

1 Answer 1

Reset to default 0

To resolve this Use ODBC Driver 18 for SQL Server (latest version) and update your connection string or else try 64 bit driver. 32-bit drivers are restricted in how much data they can handle at once because of memory addressing limits

If the VARCHAR(MAX) column is not truly required to store large text, consider altering the column to a VARCHAR(n) type where n is the maximum length.

ALTER TABLE your_table
ALTER COLUMN your_column VARCHAR(4000);

本文标签: