If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > single row and multirow operations

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-04, 03:01
harshal_in harshal_in is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 11-20-04, 03:15
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
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"
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 11-20-04, 04:23
harshal_in harshal_in is offline
Registered User
 
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...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On