-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] [Microsoft][ODBC Driver 17 for SQL Server]Invalid character value for cast specification #1448
Comments
I can reproduce this, so I'll look into what might be causing it |
Update: I haven't fully figured out the exact change that caused this bug, still looking, but the reason is that it on the second insert the driver doesn't try to detect the type of the variable and uses the setting from the first insert. So '1000' is detected as BIGINT, everything is fine, then tries to insert 'abcd' as BIGINT, which doesn't work. I suspect it binds the variable and doesn't rebind when it's a different type. I'm trying to find the change that is the culprit. |
Keep the same behavior as 5.9 Issue #1448
* Reset type after bind param Keep the same behavior as 5.9 Issue #1448 * Add unit test, skip for decimal format * Add unit test, skip for decimal format * Update unit test
This issue has been fixed in |
* Reset type after bind param Keep the same behavior as 5.9 Issue #1448 * Add unit test, skip for decimal format * Add unit test, skip for decimal format * Update unit test
PHP version 8.0.28
PHP SQLSRV version 5.10.0 and 5.11.0
Microsoft ODBC Driver version msodbcsql17 -- 17.8.1.1
SQL Server version Azure SQL Database
Client operating system Mac OS 10.15.7
Table schema
Problem description
When attempting to use a statement to insert two records into a table, and values have different data types, an error is produced.
Expected behavior and actual behavior
actual: [Microsoft][ODBC Driver 17 for SQL Server]Invalid character value for cast specification
expected: (success)
Repro code or steps to reproduce
The following reproduces consistently when running sqlsrv v5.10.0 and v5.11.0
!important! Please note that the above snippet DOES NOT produce an error in sqlsrv v5.9.0. Bug must have been introduced in v5.10.0
The text was updated successfully, but these errors were encountered: