diff --git a/application/helpers/export_helper.php b/application/helpers/export_helper.php index 86112bf23d8..9b46e0f3766 100644 --- a/application/helpers/export_helper.php +++ b/application/helpers/export_helper.php @@ -1758,8 +1758,14 @@ function quexml_export($surveyi, $quexmllan, $iResponseID = false) case "R": //RANKING STYLE quexml_create_subQuestions($question, $qid, $sgq, $iResponseID, $fieldmap, true); + $sqllength = "CHAR_LENGTH"; + $platform = Yii::app()->db->getDriverName(); + if ($platform == 'mssql' || $platform == 'sqlsrv' || $platform == 'dblib') { + $sqllength = "LEN"; + } + $QROW = Yii::app()->db->createCommand() - ->select('MAX(CHAR_LENGTH(code)) as sc') + ->select('MAX(' . $sqllength . '(code)) as sc') ->from("{{answers}}") ->where(" qid=:qid AND language=:language", array(':qid'=>$qid, ':language'=>$quexmllang)) ->queryRow();