Saving into a VARCHAR(MAX) throwing error in some scenarios
1
vote
1
answer
4877
views
We are noticing an error like this:
InterfaceError: ('HY104', 0, '[Microsoft][SQL Server Native Client 11.0]
Invalid precision value', 10226)
It happens when we insert a certain length of characters along with Unicode content like
\u3000
(Ideographic Space ). This happens only we are using the Windows MSSQL Driver and the query is parametrized.
The column is a VARCHAR(MAX)
. So it should support 2GB.
* What could be the reason for this?
* Why is it that length matters?
If I just insert this Unicode character alone, it won't cause an issue!
I was trying to see this from a theoretical point of view. Switching to NVARCHAR
is not an option for us currently, but removing Unicode is.
Here are some more details as per the questions asked by Solomon Rutzky:
1. Column Collation is SQL_Latin1_General_CP1_CI_AS
2. String length where I start seeing the error is 4019
.
3. sqlalchemy.connectors.mxodbc, line 86, in error_handler
is where I get the initial error. This is from the traceback.
4. It works fine with single Unicode character.
5. A 20000 character string without Unicode works fine.
6. It makes it ASCII from when I try this from this software (Web App). I tested in Dbeaver by exporting the data.
Asked by Nishant
(899 rep)
Jul 21, 2017, 02:34 PM
Last activity: Jul 24, 2017, 02:34 PM
Last activity: Jul 24, 2017, 02:34 PM