vendredi 24 juillet 2015

How to get the RAISERROR message from Stored Procedure in sql server in zend framework 2

I am executing sql server stored procedures, and in output i am getting two things result and message when i execute it from Sql Server management studio. But i don't know how do i get that message in zend framework 2 when i am executing the stored procedure?

  class myController{
     public function indexAction() {   
        $getResource = $this->fetchTransStatus('123');
        $obj = sqlsrv_fetch_array($getResource, SQLSRV_FETCH_ASSOC);
        // $obj will give the result coming from database,
        // but i am not getting the message coming from stored procedure
        // which i it is sending through RAISERROR 
     }
     public function fetchTransStatus($data = null)
     {
         $procedure = 'procedure_name';
         $params = " @param1 = $data, @param2 = 1";
         $stmt = $this->tableGateway->getAdapter()->createStatement();
         $stmt->prepare("EXEC $procedure $params");
         $result = $stmt->execute();
         return $result->getResource();
      }
  }

How will i get the RAISERROR message coming from stored procedure in zend framework 2?

Aucun commentaire:

Enregistrer un commentaire