Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit rows returned 1

Status
Not open for further replies.

pauljt

Technical User
Feb 26, 2003
31
GB
What command can I issue to limit the number of
rows returned from a DB2 database?
Thanks

 
Additionally:

I am accessing the database via ODBC drivers and WinSQL.
 
Obviously you can limit the amount fo rows returned by using WHERE clauses. But if you only want the first 5 rows, when 100 satisfy the WHERE clauses, then you can code:

FETCH FIRST 5 ROW ONLY

to the select statement. After 5 rows have been obtained (or however many you need) an SQLCODE of 100 will be returned.

Hope this helps.

Marc
 
That works fine, great.

Basically I am working with an unfamiliar database at
present and this helps quickly look at sample data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top