Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query failed in (while using mssql_query() and php)

My query:

$query_total = mssql_query("SELECT count(*) FROM table_name",$link);

The above query gives the error log:

PHP Warning:  mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: Query failed in ...

Count of around 10 cr is expected with above query.

When I use the same query with limit of 100 i.e:

$query_total = mssql_query("SELECT top 100 * FROM table_name",$link);

The above query runs successfully giving me the count.

I have tried:

  1. mssql_get_last_message(), but I don't capture any logs.
  2. set_time_limit(0);
  3. ini_set("max_execution_time", 0);
  4. ini_set("memory_limit","16M");

Update 1:

Even tried this,

ini_set ( 'mssql.textlimit' , '65536' );
ini_set ( 'mssql.textsize' , '65536' );

Still not working.

Please help on how can I get the heavy query executed.


1 Answers

I think I got the solution:

I increased the memory limit to 512M and sql time out to 10min and then I could get the count of around 100 milloin rows.

ini_set('memory_limit', '512M');
ini_set('mssql.timeout', 60 * 10); // 10 min

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!