Menu

MSSQL stored proc. php odbtp problem

Help
2009-02-20
2013-04-22
  • JBC Helpdesk

    JBC Helpdesk - 2009-02-20

    php code workes fine:

    $SQLQuery = "proc_".$proc."_Web_o @Subscriber='".$usersid."', @DaysBack=".$time.";";
    $SQLResult = odbtp_query($SQLQuery);

    while ($csv = odbtp_fetch_row($SQLResult))
    {
      $dat=date('d/m/y',strtotime(substr($csv[0],0,$cutoff)));
      echo str_replace(" ","/",$dat).",".$csv[1].",".$csv[2].",".$csv[3].",".$csv[4].",".$csv[5]."\r\n";
    }

    when the stored procedure looks like:
    select top 5 * from _tbl_INDEXFIXINGS
    or
    select top * from IndexFixings

    but when there is an insert in the procedure like:
    insert into _tbl_INDEXFIXINGS
    select top 5 * from IndexFixings where EvalDate=>@DateBack and EvalDate<@LAST
    select top 5 * from _tbl_INDEXFIXINGS

    it does not work, there is no data send back to the php site
    (but he makes the insert on the MSSQL Server)

    I don't think that this is a problem with the permissions

    please help

     
    • Robert Twitty

      Robert Twitty - 2009-02-20

      The problem is most likely the result of not retieving the affected row count generated by the INSERT.  You will need to use odbtp_next_result().  This function is required to proccess transactions that generate multiple results. To avoid this, include the following statement at the top of your proc:

      SET NOCOUNT ON

      This will suppress the generation of affected row counts.

      -- bob

       
    • JBC Helpdesk

      JBC Helpdesk - 2009-02-23

      thanks for the help "set nocount on" works fine!

       

Log in to post a comment.