--- moodle-1.9.4/mod/data/filter.php 2007-01-04 18:02:47.000000000 -0800 +++ moodle-edited/mod/data/filter.php 2009-02-13 15:25:51.000000000 -0800 @@ -25,6 +25,9 @@ if (empty($contentlist)) { // We look for text field contents only, and only if the field has // autolink enabled (param1). + // MSSQL doesn't let you use a text or ntext column in a WHERE clause, so we + // check if the dbtype is mssql or mssql_n, and cast df.param1 (which is an ntext type) + // as nvarchar(255) and compare against that $sql = 'SELECT dc.id AS contentid, ' . 'dr.id AS recordid, ' . 'dc.content AS content, ' . @@ -38,8 +41,13 @@ 'AND df.id = dc.fieldid ' . 'AND d.id = dr.dataid ' . 'AND dr.id = dc.recordid ' . - "AND df.type = 'text' " . - 'AND df.param1 = 1'; + "AND df.type = 'text' "; + if($CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n') { + $sql .= 'AND CAST(df.param1 AS nvarchar(255)) = \'1\''; + } else { + $sql .= 'AND df.param1 = 1'; + } + // End Mod if (!$datacontents = get_records_sql($sql)) { return $text;