0

I have an SQL query which returns 792 rows (currently - it varies).

When I try to display the results on a webpage, a JSON object, the page is blank. I know that the reason for this is some sort of maximum limit on results - through trial & error (using SELECT TOP) I know the limit is around the 430 mark (although I'm sure it's based on data rather than number of rows).

How can I increase this limit? I am running PHP Version 7.3.8 x64 on IIS 8.5

My PHP code is

$sql = "SELECT * FROM dbo.Files WHERE Status = 'Open'";

$stmt = sqlsrv_query($mysqli, $sql);

$result = array(); 
do {
    while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)){
       $result[] = $row; 
    }
} while (sqlsrv_next_result($stmt));


sqlsrv_free_stmt($stmt);
sqlsrv_close($mysqli); 

echo json_encode($result);
James
  • 33
  • 6
  • It's very important what is your actual statement, but this [answer](https://stackoverflow.com/questions/62185448/does-sqlsrv-query-limit-the-number-of-statements-that-can-be-exectuted-in-one-qu/62189368#62189368) may help. – Zhorov Jun 30 '20 at 19:50
  • Are you calling a function, a stored procedure? Is the object you're returning big enough to handle all the rows (e.g., VARCHAR(MAX))? – critical_error Jun 30 '20 at 19:58
  • @Zhorov why is my statement important? I have already established that limiting the results 'fixes' the problem so it is obviously not a syntactical error. My statement is `SELECT * FROM dbo.Files WHERE Status = 'Open'` – James Jul 02 '20 at 13:41
  • @James Because, if you execute an INSERT, DELETE or UPDATE statement (without SET NOCOUNT ON), the SQL Server returns the count of the affected rows as an informational message. But your case is different. Probably, if you post the PHP code, the problem will be more clear. Thanks. – Zhorov Jul 02 '20 at 14:27
  • @Zhorov I see, thanks. I have updated my post to include the PHP – James Jul 02 '20 at 18:36

0 Answers0