Friday, December 16, 2011

sqlsrv_execute could not retrieve all rows?

Since I'm using sqlsrv driver for my php web application development, I started to test the usage of the commands.

One of my testings is using sqlsrv_prepare and sqlsrv_execute to execute a stored procedure which have 18 parameters input and 106 columns output, and it should returns 360 rows in this test.

However, I found that it only returned 35 rows. After spending a night, it seems there was not much usage and footprints left on the web about this issue. Then, I try to replace sqlsrv_execute with sqlsrv_query since they at least got similar purpose, and I found sqlsrv_query has no problem on this! weird...anyway, sqlsrv_query got the job done.

updated 1: However, when I tried to create a html table to contain the result set look like in a grid that the user used to work with. The result set now only returned 35 rows again!!! Don't know the problem yet, may be the problem of resource allocation being limited? Let's see what I'll find...

updated 2: It looks like the problem was caused by the field of strings/data it retrieved from database with the combination of php code embedding with html code, since my data contains non-latin characters.

After I added date_format() to the datetime specific column and "ReturnDatesAsStrings"=>false in the connectionInfo. The problem is gone again.

No comments: