CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cannot insert explicit value for identity column in table 'lime_questions' when IDENTITY_INSERT is set to OFF.. The SQL statement executed was: INSERT INTO [dbo].[lime_questions] ([parent_qid], [sid], [gid], [type], [title], [other], [scale_id], [same_default], [qid], [question], [preg], [help], [mandatory], [question_order], [language], [relevance], [modulename]) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10, :yp11, :yp12, :yp13, :yp14, :yp15, :yp16)

E:\WebSite\limesurvey\framework\db\CDbCommand.php(358)

346         {
347             if($this->_connection->enableProfiling)
348                 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute');
349 
350             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
351             $message=$e->getMessage();
352             Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
353                 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
354 
355             if(YII_DEBUG)
356                 $message.='. The SQL statement executed was: '.$this->getText().$par;
357 
358             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
359                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
360         }
361     }
362 
363     /**
364      * Executes the SQL statement and returns query result.
365      * This method is for executing an SQL query that returns result set.
366      * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative
367      * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
368      * them in this way can improve the performance. Note that if you pass parameters in this way,
369      * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
370      * Please also note that all values are treated as strings in this case, if you need them to be handled as

Stack Trace

#2
+
 E:\WebSite\limesurvey\application\models\Question.php(1149): CActiveRecord->save()
1144         $oRecord = new self;
1145         foreach ($data as $k => $v) {
1146             $oRecord->$k = $v;
1147         }
1148         if ($oRecord->validate()) {
1149             return $oRecord->save();
1150         }
1151         Yii::log(\CVarDumper::dumpAsString($oRecord->getErrors()), 'warning', 'application.models.Question.insertRecords');
1152     }
1153 
1154 }
#3
+
 E:\WebSite\limesurvey\application\controllers\admin\database.php(1377): Question->insertRecords(array("qid" => "491363", "parent_qid" => "491362", "sid" => "999245", "type" => "T", ...))
1372                                     } else {  // additional languages
1373                                         $aInsertData['qid'] = $aSubquestionIds[$sSubquestionIndex]; // get qid from array
1374                                     }
1375 
1376                                     $aInsertData['parent_qid'] = $this->iQuestionID;
1377                                     if (Question::model()->insertRecords($aInsertData)){
1378                                         if ($sLanguageIndex == 0){ // main language
1379                                             $aSubquestionIds[$sSubquestionIndex] = getLastInsertID('{{questions}}'); // save qid into the array
1380                                         }
1381                                     }
1382                                 }
#4
+
 E:\WebSite\limesurvey\application\controllers\admin\database.php(127): database->actionInsertCopyQuestion(999245)
122         }
123         if ($sAction == "updatesubquestions" && Permission::model()->hasSurveyPermission($this->iSurveyID, 'surveycontent', 'update')) {
124             $this->actionSubQuestions($this->iSurveyID);
125         }
126         if (in_array($sAction, array('insertquestion', 'copyquestion')) && Permission::model()->hasSurveyPermission($this->iSurveyID, 'surveycontent', 'create')) {
127             $this->actionInsertCopyQuestion($this->iSurveyID);
128         }
129         if ($sAction == "updatequestion" && Permission::model()->hasSurveyPermission($this->iSurveyID, 'surveycontent', 'update')) {
130             $this->actionUpdateQuestion($this->iSurveyID);
131         }
132         if (($sAction == "updatesurveylocalesettings") && (Permission::model()->hasSurveyPermission($this->iSurveyID, 'surveylocale', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update'))) {
2021-12-23 17:18:22 Microsoft-IIS/10.0 Yii Framework/1.1.24-dev