Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Select Top 100 Not Working in DB2

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Select Top 100 Not Working in DB2

    I am trying to use the TOP keyword in my SELECT statement against a DB2 database on our AS/400. I am finding out that this keyword doesn't seem to be supported in the DB2 SQL syntax, like it is in MS SQL Server. So I guess my question is, is there something similar in the DB2 SQL syntax that will allow me to retrieve the top 100 records of a query resultset? Thanks in advance, Brian Harr

  • #2
    Select Top 100 Not Working in DB2

    TOP is a non-standard SQL extension, and IBM tries to limit the amount of non-standard stuff that makes its way into the DB2 products. You'll want to do something like: SELECT ... FETCH FIRST [n] ROWS ONLY

    Comment

    Working...
    X