-
Notifications
You must be signed in to change notification settings - Fork 11.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Eloquent on MSSQL return error SQLSTATE[IMSSP]: Field 2 returned no data. #48412
Comments
Gonna go on a hunch and say it's related to #47937. I'm not sure why things broke for you but if it broke while updating mssql dependencies then it doesn't looks like a Laravel issue to me. |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
#47937 was fixed by php-sqlsrv-5.11.1-1.el9.remi.8.1.x86_64 therefore I updated to PHP 8.1.23 and php-sqlsrv-5.11.1 to see whether my app having any comparability issue. It must be difference.
To be fair, error like this can be caused by:
|
To clarify, it seem only throw error on |
Can you test with Laravel Framework version before the whole PDO issue solved the problem? This can eliminate if any recent changes would cause any issue. |
I just revert to Laravel version 10.0.0, but it's still not working :( |
Just out of curiosity: try removing the dbo from your $table var on your model |
Update:
|
thanks, I tried but unfortunately it still not work. |
ok, try adding 'charset' => 'utf8' to your database connection config. It might not work, but the error should change. |
thanks, it's in my config/database.php already |
One more: Are you able to perform the query in your MsSQL client app? |
Yes, works on native sqlcmd on same machine Edit: it show results in sqlcmd, but also error at the end: Sqlcmd: Error: Internal error at ReadAndHandleColumnData (Reason: Error reading column data). To clarify: my webapp run in WSL (Alma), and this sqlcmd run on same WSL. If I copy the same query to run on Heidi on Windows, it works perfectly fine. |
Update: if I select certain fields, it will have this error:
It seem somehow related to encoding. |
I open an issue in sqlsrv repo microsoft/msphpsql#1479, will close this if can confirm it's other side's issue |
I tried to reproduce it, but no matter what I did, I couldn't get the error to occur. At least php/php-src#11622 is irrelevant. It's possible that other parts included in Microsoft's hotfix are having an effect, but I don't know because I haven't looked closely. It may be easier to advise if you state what the original version of both php and sqlsev was. It says it's a minor update, so are thay 8.0 and 5.10? |
My PHP version PHP SQLSRV or PDO_SQLSRV version Microsoft ODBC Driver version SQL Server version Microsoft SQL Server 2016 Database collation: I think it relates to converting Unicode. |
What are previous versions? |
It was php-8.1.21 and php-sqlsrv-5.11.0 |
Thank you. Can you share the definition part of the Laravel migration file? Also, I would like to know what settings are made for the sql server part of |
It also throw error if I select CardType, with other error |
Could I want to know the exact contents of the migration file. |
It's OCRD table for SAP B1 database, you can find it here https://sap.erpref.com/?schema=BusinessOne9.3&module_id=3&table=OCRD |
Hmm. Apparently I don't have enough time to reproduce this. |
Thank you very much for your kind effort. |
Is it possible that this is involved? |
Thank you, it's not. I have |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Laravel Version
10.23.1
PHP Version
8.1.23
Database Driver & Version
php-sqlsrv-5.11.0-1.el9
Description
OS: Alma 9
After minor update to PHP
php-8.1.23-1.el9.remi.x86_64
and SQL_SRVphp-sqlsrv-5.11.1-1.el9.remi.8.1.x86_64
, my app broke, throw error for simple Eloquent call:Model
Error:
SQLSTATE[IMSSP]: Field 2 returned no data.
select top 1 * from [dbo].[OCRD]
The above raw query (generated by Laravel) works perfectly if I run in a native SQL client.
Before upgrading, my app works perfectly fine.
Steps To Reproduce
Model
(or whatever model, it will break anyway)
Tinker (or controller)
$client = BusinessPartner::first();
This line will throw error.
The text was updated successfully, but these errors were encountered: