On 2019-12-12 19:59, Clyde Eisenbeis [email protected] [firebird-support] 
wrote:
> This finds all records:
> ``````````````````````````````````
>     "SELECT * FROM " + stTableName
> 
> ``````````````````````````````````
> 
> This does not work:
> 
> ``````````````````````````````````     "SELECT * FROM " + stTableName
> + " FETCH 10 ROWS"
> ``````````````````````````````````

Assuming you are using Firebird 3, you are missing the FIRST (or NEXT) 
keyword before the number and the ONLY keyword after ROWS.

In Firebird 3 and higher you can use the SQL standard fetch clause:

SELECT *
FROM <table>
FETCH FIRST 10 ROWS ONLY

See [SQL:2008-Compliant OFFSET and FETCH Clauses][1]

In Firebird 2.0 and higher you can use:

SELECT *
FROM <table>
ROWS 10

See [ROWS][2]

In Firebird 1.0 and higher you can use:

SELECT FIRST 10 *
FROM <table>

See [FIRST, SKIP][3]

Mark

  [1]: 
https://www.firebirdsql.org/file/documentation/release_notes/html/en/3_0/bk02ch09s06.html#rnfb30-dml-offsetfetch
  [2]: 
https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-dml-select.html#fblangref25-dml-select-rows
  [3]: 
https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-dml-select.html#fblangref25-dml-select-first-skip

Reply via email to