On 30 Mar 2016, at 6:35pm, Tim Stowell <TStowell at navexglobal.com> wrote:

> SELECT TOP (20) [t0].[field1], [t0].[ field1], [t0].[field2] FROM [tablename] 
> AS [t0]
> 
> Instead of the "TOP" keyword it should be "LIMIT"

Hmm.  I'd just like to point out that the syntax diagram for SQLite says that 
the LIMIT clause must appear at the end of the command (apart from the optional 
OFFSET clause which may appear after it).  So the fix is not just to replace 
TOP with LIMIT, but something more than that.  I suspect that the 'Linq' 
editors need to take a close look at their source code

The confusion comes from the fact that SQL92 didn't include any way to limit 
the number of results so different engines implemented it in different ways.  I 
suspect SQLite got 'LIMIT' from PostgreSQL.  Other engines use 'TOP' or 'FIRST' 
or 'ROWS' or 'ROWCOUNT' in different places in the command.  It's a mess.

Simon.

Reply via email to