Getting top n to n rows from db2

后端 未结 2 1307
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-12 03:16

I need to split a huge table in to chunks.

Fetching data from DB2 and processing in SSIS

iteration 1 : Get first 10 rows and process it

2条回答
  •  醉酒成梦
    2020-12-12 03:42

    https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.doc/doc/r0061832.html

    db2 "select row_number() over(order by tabschema, tabname)
    ,    tabschema::char(10), tabname::char(30)
    from syscat.tables
    order by tabschema, tabname 
    offset 10 rows 
    fetch first 10 rows only"
    
    1                    2          3                             
    -------------------- ---------- ------------------------------
                      11 SYSCAT     COLCHECKS                     
                      12 SYSCAT     COLDIST                       
                      13 SYSCAT     COLGROUPCOLS                  
                      14 SYSCAT     COLGROUPDIST                  
                      15 SYSCAT     COLGROUPDISTCOUNTS            
                      16 SYSCAT     COLGROUPS                     
                      17 SYSCAT     COLIDENTATTRIBUTES            
                      18 SYSCAT     COLLATIONS                    
                      19 SYSCAT     COLOPTIONS                    
                      20 SYSCAT     COLUMNS                       
    
      10 record(s) selected.
    

提交回复
热议问题