Connecting Tech Pros Worldwide Help | Site Map

Update rows in

Member
 
Join Date: Sep 2007
Posts: 70
#1: Feb 18 '09
I have two tables, Update1 and Master1. Master1 is thousands of records and is recreated twice a day. The Update1 rows are created when someone reads and updates a Master1 row (since Master1 gets dropped and recreated twice a day).

I am writing a stored proc to re-connect the two tables. My question is: what is the most performant way when I drop and repopulate Master1, to iterate through Update1 and to set a bit column to true in Master1 (if a record exists in Update1)?

Any help would be appreciated.
gpl gpl is offline
Member
 
Join Date: Jul 2007
Posts: 34
#2: Feb 19 '09

re: Update rows in


Try something like this

Expand|Select|Wrap|Line Numbers
  1. UPDATE Master1
  2. SET bitfield=1
  3. FROM Master1 m1
  4. INNER JOIN Update1 u1 ON m1.keyvalue=u1.keyvalue
Member
 
Join Date: Sep 2007
Posts: 70
#3: Feb 19 '09

re: Update rows in


gpl,

Thanks for the pointer. I was trying to avoid a join, but if that will likely be faster than using a cursor (I would think).
Reply