Multiple SQL Update Statements in single query

后端 未结 6 1438
遥遥无期
遥遥无期 2020-12-17 16:23

I am in a situation where I am having to update about 12,000 items in my DB. Each row needs to mirror an excel file that I made previously. I have made the file that creates

6条回答
  •  情深已故
    2020-12-17 16:54

    If you have a significant amount of data to update, it may be advantageous to load the excel file into the database as a table, then update your table based on the data in this loaded table.

       UPDATE RPT_ITM_D
          SET F1301 = NewTable.Value
         FROM RPT_ITM_D INNER JOIN NewTable ON (NewTable.F01 = RPT_ITEM_D.F01);
    

    If you're on SQL server, you could use SSIS to load the file pretty quickly.

提交回复
热议问题