Update rows in

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stoogots2
    New Member
    • Sep 2007
    • 77

    Update rows in

    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
    New Member
    • Jul 2007
    • 152

    #2
    Try something like this

    Code:
    UPDATE Master1
    SET bitfield=1
    FROM Master1 m1
    INNER JOIN Update1 u1 ON m1.keyvalue=u1.keyvalue

    Comment

    • stoogots2
      New Member
      • Sep 2007
      • 77

      #3
      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).

      Comment

      Working...