Results 1 to 3 of 3

Thread: Set Rowcount

  1. #1
    Join Date
    Sep 2003
    Location
    New Jersey
    Posts
    4

    Lightbulb Unanswered: Set Rowcount

    Does anyone know how I can set a row count on a DB2-UDB Database. I am trying to delete 20000 rows. I need to break this delete in 2 batches of 10000 each. I need to know how I can set a row count parameter or a variable so that when I run my DELETE statement only 10000 rows get deleted at one time.

    Thanks in advance.

    Alee

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Set Rowcount

    I have not heard of any rowcount options as you mention ...
    But, There are two options :

    1) Break down the delete into multiple deletes using a WHERE Clause

    2) Write a stored procedure to commit every n deletes

    Sathyaram

    Originally posted by aleeali
    Does anyone know how I can set a row count on a DB2-UDB Database. I am trying to delete 20000 rows. I need to break this delete in 2 batches of 10000 each. I need to know how I can set a row count parameter or a variable so that when I run my DELETE statement only 10000 rows get deleted at one time.

    Thanks in advance.

    Alee
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Dec 2002
    Posts
    134

    Re: Set Rowcount

    I do not how efficeint this aproach is, but in v8 the following should work

    delete from address where name in (select name from address order by name fetch first 1 row only)

    Soon (one of upcoming v8 fixpacks) you will be able:
    delete from (select name from address order by name fetch first 1 row only)


    http://groups.google.com/groups?hl=e...lete%2Bfrom%2B(select%2Bname%2Bfrom%2Baddress%2B%2Bgroup:comp.da tabases.ibm-db2%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.databases.ibm-db2%26selm%3Dbidtmq%2524qn1%25241%2540hanover.toro lab.ibm.com%26rnum%3D1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •