Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    single row and multirow operations

    I have some confusions about single row operations and multi row set operations.
    can anyone please explain me in detail..

    thanks in advance..

    harshal.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    single row:

    update employees set salary = salary*0.9 where employee="harshal_in"

    multiple row:

    update employees set salary = salary*1.1 where employee<>"harshal_in"
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    thanks for the reply rudy.
    now if i got a million rows in a table and need to select the data on some criteria, return these records to the calling application
    and after this selection need to update the records which were selected above.
    I do it in transaction like:
    begin transaction set1
    select records from Table_name
    where some criteria
    update table_name set records where some criteria
    commit transaction.

    now this is a multi row operation (if im not wrong)

    how can this be converted to a single row operation ...
    someone suggested that single row operation will me more scallable
    scalablein terms like if some operation is to be done on some chunk of data (say about 5 million rows) then for a multi row operation each time the whole table is scanned even those records which are already been operated on, now what I am looking for is a stop start type solution like I have 10 rows , I execute a sp which performs some operation on these 10 rows, so the next time when the same sp is run, it wont read these records staright away start off with the 11th record. some thing like a pointer ...
    I m sorry if im making it confusing to understand...

Posting Permissions

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