0
I came across an sql error, but when running the query in SQL Server Studio returns me the normal query. Query that is below.
SELECT
CAST(REPLACE(CAST(DsXML as Nvarchar(Max)),' xmlns="http://www.portalfiscal.inf.br/nfe"','') as xml).value('(/nfeProc/NFe/infNFe/transp/vol/qVol/node())[1]', 'int') as [qVol]
FROM SPDNFE
WHERE CdIdNFe = 'NFe13161203976141000132550030000435291400513027'
When I transport the same sql query to php, it returns an error. How it is in php:
public function teste($nrchave) {
$sql = "SELECT
CAST(REPLACE(CAST(DsXML as Nvarchar(Max)),' xmlns=\"http://www.portalfiscal.inf.br/nfe\"','') as xml).value('(/nfeProc/NFe/infNFe/transp/vol/qVol/node())[1]', 'int') as [qVol]
FROM SPDNFE
WHERE CdIdNFe = '$nrchave'";
$results = array();
$stmt = $this->conn->prepare($sql);
$stmt->execute();
if ($stmt) {
while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$info = new Model();
$info->setQVol($row->qVol);
$results[] = $info;
}
}
return $results;
}
Error:
Uncaught Exception 'Pdoexception' with message 'SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]SELECT failed because the following SET options have incorrect Settings: 'ARITHABORT'. Verify that SET options are correct for use with Indexed views and/or Indexes on computed Columns and/or Filtered Indexes and/or query Notifications and/or XML data type methods and/or Spatial index Operations.'