Skip to content
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

HY104 Invalid precision value when reusing prepared statement #1491

Closed
Leiothrix1 opened this issue Dec 4, 2023 · 4 comments
Closed

HY104 Invalid precision value when reusing prepared statement #1491

Leiothrix1 opened this issue Dec 4, 2023 · 4 comments

Comments

@Leiothrix1
Copy link

Versions:
PHP: 8.2.13
sqlsrv: 5.11.1
ODBC driver: 18.3.2.1
SQL Server: 14.0.3038.14
Server OS: Windows Server 2016

Test table:
CREATE TABLE dbo.TestTable (
TestColumn VARCHAR (8000) NULL
)

Test code: attached
TestCase.txt

Expected output: two identical rows inserted into the database.

Actual output:
The first row is inserted in the database, and the second fails with error:
HY104 [Microsoft][ODBC Driver 18 for SQL Server]Invalid precision value

This code works fine if SQLSRV_SQLTYPE_VARCHAR() is set <= 4000 or to MAX. If it is between 4001->8000 it produces the error above on the second insert. This also works if the SQL type is not specified in the prepared statement. Note that there is nothing changing between the inserts, it is just sqlsrv_execute being executed twice.

@v-makouz
Copy link
Contributor

v-makouz commented Dec 5, 2023

I can't seem to reproduce this one. Can you provide an ODBC trace?

@Leiothrix1
Copy link
Author

Sorry I didn't know that option even existed or I would have included that originally.

Trace is attached.

trace.txt

Thanks!

@v-makouz
Copy link
Contributor

Strangely, in my tests, I could reproduce this error with 5.10 version of the PHP driver, but not 5.11. But you're already using 5.11, so I will investigate this further

@v-makouz
Copy link
Contributor

I was able to reproduce this, we are now looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants