findmypast-oss / mssql_ecto

Ecto adapter for Mssqlex
Apache License 2.0
49 stars 20 forks source link

Limit statements do not work in SQL Server 2008 #3

Closed toddharding closed 7 years ago

toddharding commented 7 years ago

Expected Behavior

To be able to limit the number of returned values in a query

Current Behavior

The query will fail and throw a syntax error

Possible Solution

If we can detect the SQL Server version we can substitute in TOP statements instead of using FETCH OFFSET

Steps to Reproduce (for bugs)

Use limit in an ecto query e.g.

from(u in User, where: u.id == ^current_user, limit: 1)

Your Environment