Skip to content

Bug: [SQLSRV] Incorrect syntax near 'OFFSET' #5663

Description

@demirkaric

PHP Version

7.4

CodeIgniter4 Version

4.1.8

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows, Linux

Which server did you use?

apache

Database

MSSQL Server 2008

What happened?

In the documentation it's stated: MSSQL via the SQLSRV driver (version 2005 and above only)
This is wrong statement, let's check the next code sample in the Steps to Reproduce.

Steps to Reproduce

$model->builder("tblTest")->select("Barcode")->where("Barcode", $data->Barcode)->first();

This produces next query:

SELECT "Barcode"
FROM "DB"."dbo"."tblTest"
WHERE "Barcode" = '1AP06456 R2104604 6 1'
ORDER BY (SELECT NULL)  OFFSET 0  ROWS FETCH NEXT 1 ROWS ONLY 

Expected Output

Since we use version MSSQL 2008 and OFFSET is supported from version 2012 and above.
This should be fixed or the documentation should be corrected.

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix themdatabaseIssues or pull requests that affect the database layerdocumentationPull requests for documentation only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions