Update
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Update

  1. #1
    Join Date
    May 2002
    Posts
    27
    How to write a query to update alternate rows in a Table.

    I mean whether all even rows or all odd rows should be updated from the query.

    Is there any way to increase the performance if million of rows are there in some table.and if i want to update all the rows (single column in each row) then how can be make the process fast.

    Thanks in Advance !

    Ashish

  2. #2
    Join Date
    Feb 2001
    Posts
    180
    Hi Ashish,
    Maybe is will give some answers:

    update my_table
    set my_column = my_value
    where mod(my_row_number,2) = 0;
    Using the rownum is a very dangerous way, it is assigned dynamicly, so it is not always the same number for the same row

    Increasing performance can be achieved by:
    1 Partitioning and parallel processing
    2 When updating some rows, use a proper index (function, bitmap, ...)
    Regards
    Ben de Boer

  3. #3
    Join Date
    May 2002
    Posts
    27

    Hello

    This is also not working as it is showing that 0rows updated

    AShish

  4. #4
    Join Date
    Feb 2001
    Posts
    180
    What did you use for 'my_row_number'
    Show me your query
    Regards
    Ben de Boer

  5. #5
    Join Date
    Feb 2002
    Location
    Dallas , Texas
    Posts
    158
    Hi,

    Bensr's query works absolutely fine.

    Take Care.


Posting Permissions

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



Click Here to Expand Forum to Full Width