--- moodle-1.9.4/mod/resource/filter.php 2008-12-07 15:04:33.000000000 -0800 +++ moodle-edited/mod/resource/filter.php 2009-02-13 15:31:05.000000000 -0800 @@ -37,6 +37,14 @@ * linked first. And order by section so we try to * link to the top resource first. */ + + // MSSQL uses 'LEN' instead of 'CHAR_LENGTH'. We now check if we're using mssql or mssql_n, and modify the SQL accordingly. + if($CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n') { + $char_length = 'LEN'; + } else { + $char_length = 'CHAR_LENGTH'; + } + $resource_sql = "SELECT r.id, r.name FROM {$CFG->prefix}resource r, {$CFG->prefix}course_modules cm, @@ -46,7 +54,9 @@ cm.visible = 1 AND r.id = cm.instance AND cm.course = {$courseid} - ORDER BY CHAR_LENGTH(r.name) DESC, cm.section ASC;"; + ORDER BY {$char_length}(r.name) DESC, cm.section ASC;"; + + // End Mod if (!$resources = get_records_sql($resource_sql) ){ $nothingtodo = true;