CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[07002]: [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error. The SQL statement executed was: SELECT q.* , group_name, group_order FROM lime_questions q, lime_groups g, lime_question_attributes qa
WHERE g.gid = q.gid AND g.language = :lang AND q.language = :lang AND q.sid = :surveyid AND q.qid = qa.qid AND q.parent_qid = 0 AND qa.attribute = 'public_statistics'AND CAST(CAST(qa.value as varchar) as int)='1'

C:\etc\Apache\htdocs\MSSQL\framework\db\CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#1
+
 C:\etc\Apache\htdocs\MSSQL\application\controllers\Statistics_userController.php(206): CDbCommand->queryAll()
201         {
202             $query .="AND qa.value='1'\n";
203         }
204 
205         //execute query
206         $result = Yii::app()->db->createCommand($query)->bindParam(":lang", $language, PDO::PARAM_STR)->bindParam(":surveyid", $iSurveyID, PDO::PARAM_INT)->queryAll();
207 
208         //store all the data in $rows
209         $rows = $result;
210 
211 
#11
+
 C:\etc\Apache\htdocs\MSSQL\index.php(178): CApplication->run()
173  *
174  */
175 require_once BASEPATH . 'yii' . EXT;
176 require_once APPPATH . 'core/LSYii_Application' . EXT;
177 
178 Yii::createApplication('LSYii_Application', APPPATH . 'config/config' . EXT)->run();
179 
180 /* End of file index.php */
181 /* Location: ./index.php */
2012-10-18 08:42:19 Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Yii Framework/1.1.10