PHP PDO (MSSQL) can not get OUPUT parameters

只愿长相守 提交于 2019-12-01 19:07:08

AFAIK, the FreeTDS driver does not support OUTPUT parameters. I remember this from when my team was doing our assessment.

Here's why it doesn't work: http://www.freetds.org/faq.html#ms.output.parameters

EDIT: Here's a reference from pyodbc (which also runs on FreeTDS), so the same applies: https://code.google.com/p/pyodbc/wiki/StoredProcedures

To quote: "Results: Since we can't use output parameters at this point, you'll need to return results in a result set. Usually this means just ending your stored procedure with a SELECT statement."

You'll need to use a SELECT instead.

Your stored procedure is assigning the parameters, but not returning them.

BEGIN 
 SET @error_num = 99
 SET @error_msg = 'Error! Oh my gosh!'
 SELECT @error_num, @error_msg;  --add this line
END
GO
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!