我们在SQL Server中创建了一个存储过程,该存储过程将输入参数作为JSON。过程是在工作室管理中以JSON提供结果。但是,使用PHP代码执行该过程后,它给出了4004 SQL Server错误。我们正在使用pdo_mssql驱动程序。
我们没有在PHP中获得任何示例代码,该示例代码将输入参数作为JSON传递。我没有看到链接,但没有运气。
Getting General error: 4004 General SQL Server error:
$stored_proc_stmt = "exec SP_NAME ? ";
$pdo_stmt = $this->_db->prepare($stored_proc_stmt);
$input = '{"productCode":"ABCD"}';
$pdo_stmt->bindParam(1, $input);
$stmt = $this->_db->prepare("SET ANSI_NULLS ON");
$stmt->execute();
$stmt = $this->_db->prepare("SET ANSI_WARNINGS ON");
$stmt->execute();
$pdo_stmt->execute();
$results = $pdo_stmt->fetchAll();
预期结果应为JSON。我们不想在数据库的配置级别上进行任何更改。