Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26357

A Sql Server error is thrown when trying to view the participants of a course.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Environment:
      Windows 2008 Server, IIS 7.0
    • Database:
      Microsoft SQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Debug info: SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'FROM'.<br>
      SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'FROM'.<br>
      SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'AS'.<br>

      SELECT id, username, firstname, lastname, email, city, country, picture, lang, timezone, maildisplay, imagealt, COALESCE(lastaccess, lastaccess, ctxid, ctxpath, ctxdepth, ctxlevel, ctxinstance FROM (SELECT TOP 9223372036854775806 ROW_NUMBER() OVER(ORDER BY lastaccess DESC) AS sqlsrvrownumber, id, username, firstname, lastname, email, city, country, picture, lang, timezone, maildisplay, imagealt, COALESCE(lastaccess, lastaccess, ctxid, ctxpath, ctxdepth, ctxlevel, ctxinstance FROM (SELECT u.id, u.username, u.firstname, u.lastname,
      u.email, u.city, u.country, u.picture,
      u.lang, u.timezone, u.maildisplay, u.imagealt,
      COALESCE(lastaccess, 0) AS lastaccess, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = '2')
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> '1') e ON e.id = u.id
      LEFT JOIN mdl_user_lastaccess ul ON (ul.userid = u.id AND ul.courseid = '2')
      LEFT JOIN mdl_context ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = 30) ) AS q) AS q WHERE q.sqlsrvrownumber > 0 AND q.sqlsrvrownumber <= 20
      [array (
      0 => '2',
      1 => '1',
      2 => '2',
      )]
      Stack trace:
      line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown
      line 252 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
      line 363 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
      line 761 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
      line 454 of \user\index.php: call to sqlsrv_native_moodle_database->get_recordset_sql()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                moodle.com moodle.com
                Reporter:
                vincelong Vincent Long
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: