CodeIgniter Forums
MS SQL Stored proc returns multiple recordsets - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: MS SQL Stored proc returns multiple recordsets (/showthread.php?tid=31323)



MS SQL Stored proc returns multiple recordsets - El Forum - 06-14-2010

[eluser]btwong[/eluser]
I have a stored proc on a MS SQL server, that returns 3 recordsets.

How can i differentiate between each record set? (i want 1 field from the first recordset, and all of the second recordset).

Any ideas?


MS SQL Stored proc returns multiple recordsets - El Forum - 06-14-2010

[eluser]bretticus[/eluser]
You probably call mssql_next_result(). But I doubt this is possible using CI's ActiveRecord.


MS SQL Stored proc returns multiple recordsets - El Forum - 06-14-2010

[eluser]btwong[/eluser]
i will give it a go.

thanks


MS SQL Stored proc returns multiple recordsets - El Forum - 06-14-2010

[eluser]bretticus[/eluser]
You might wanna anaylze the adodb php library for how they accomplish this too:

http://phplens.com/adodb/reference.functions.nextrecordset.html

Good luck


MS SQL Stored proc returns multiple recordsets - El Forum - 06-14-2010

[eluser]btwong[/eluser]
CI won't allow that call - mssql_next_result($query).

I will now suss out the adodb.

Thanks heaps for your help. If i find anything useful, i will be sure to post back here.

thanks again


MS SQL Stored proc returns multiple recordsets - El Forum - 06-15-2010

[eluser]WanWizard[/eluser]
Isn't that a bit drastic?

Nobody's stopping you from calling this function outside of CI's AR system, or to add the method to CI's AR library. That seems to me a lot easier than switching to adodb...


MS SQL Stored proc returns multiple recordsets - El Forum - 08-03-2010

[eluser]btwong[/eluser]
What is the AR system that you are talking about?

Is the mssql drivers php files, or is it something else?

------------

sorry, AR = active record.

i have been using the below:
Code:
do {
        echo $this->result_id ."<br>";
        while ($row = mssql_fetch_row($this->result_id)) {
            echo "$row[0] -- $row[1]<BR>";
        }
        } while (mssql_next_result($this->result_id));


i am attempting to play around with it, and i am getting some results.