SQLSTATE[HY000]: General error: 20018 Invalid usage of the option NEXT in the FETCH statement. [2001

SQLSTATE[HY000]: General error: 20018 Invalid usage of the option NEXT in the FETCH statement. [2001

jlujanjlujan Posts: 9Questions: 3Answers: 0

hi i am testing editor-php-1.5.4 but sql server 2008 not working. I see that the syntax of the SqlserverQuery.php file has OFFSET FETCH proper to that version.
Is it possible to modify the code so that it can work on sql server 2008?

// SQL Server 2012+ only
protected function _build_limit()
{
    $out = '';

    if ( $this->_offset ) {
        $out .= ' OFFSET '.$this->_offset.' ROWS';
    }

    if ( $this->_limit ) {
        if ( ! $this->_offset ) {
            $out .= ' OFFSET 0 ROWS';
        }
        $out .= ' FETCH NEXT '.$this->_limit. ' ROWS ONLY';
    }

    return $out;
}

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    That's an old version - see this thread (also here and here), it discusses why we support from 2012 onwards,

    Colin

  • jlujanjlujan Posts: 9Questions: 3Answers: 0

    ok thanks for the clarification it will be better to migrate to SQL server 2012.
    ok gracias por la aclaración será mejor migrar a SQL server 2012.

Sign In or Register to comment.