How to do SQL select top N … in AS400

前端 未结 6 745
执笔经年
执笔经年 2020-12-28 13:40

How do you perform a

Select top N * from as400table

type query against an as400/db2 database

6条回答
  •  独厮守ぢ
    2020-12-28 14:23

    I know this is a old thread but probably my answer help to someone, the best way to limit a number of rows in AS400 is using FETCH FIRST 1000 ROWS ONLY Example: select * from myschema.mytable_name FETCH FIRST 1000 ROWS ONLY

    This will give you back the first 1000 rows.

    Of course the 1000 you can change for whatever other value needed, 10, 25, 10000, etc.

    At least this works for me in AS400 database (29-06-2020)

    Best

提交回复
热议问题