最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure sql managed instance - Getting Invalid Field Size error using ODBC for column of datatype varchar(max) - Stack Overflow

programmeradmin2浏览0评论

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);

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论