• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQLSRV Multiple Results from SP

HI I have a requirement to use a certain stored procedure (SP) on MSSQL Server 2008

This SP runs multiple SELECT statements and returns, on success, multiple results (only 1 result on failure)

what i cant seem to do is loop through the result sets and grab all the results, is this possible using CI 2.x and the latest sqlsrv drivers?

any help is vastly appreciated.

i'have already faced the same problem too with CI active record.
as i sugggested from my long searching on Goog's, theres only one solution that's really worked for me.
Read this basic post:

this is the example how i used my CI to called out my SP in MSSQL 2008:

In : ProductNamee, Price , @ProductCode, MerchantId

Please read this part, which paramater u want to set as the output:
$addProduct = $this->db->query("
DECLARE @ProductCode as varchar (100) ;
'$pname', '$price',
@ProductCode OUTPUT,
select @ProductCode;

$productCode = $addProduct[0][0];

Note: in my experience of using mssql DB with PHP, after doing some query or etc..dont forget always close DB conection. in CI just used $this->db->close();
it will reduce memory usage of MSSQL SERVER.

ok hope it will help

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.