Fetch First Clause (SQL)

Introduction

The SQL Fetch First clause specifies the number of rows to return in the query result.

Syntax

fetch-first-clause ::=
  FETCH { FIRST | NEXT } [ row-count ] { ROW | ROWS }

Remarks

row-count is an optional constant integer value or parameter that is greater than or equal to one. The value specifies the maximum number of rows to return in the query result. If row-count is omitted, the maximum rows returned in the query result is one.

The keywords FIRST and NEXT are synonyms.

The keywords ROW and ROWS are synonyms.

Examples

To fetch the first 5 digital tags:

Select FullName,Value,Quality
From TagDataPointDigital
Fetch First 5 Rows

Further Information

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.