Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

UPDATE performance

$
0
0

hi all - I have a table called trans with 15 million rows and I need to update various columns in this table; some of the updates require joining this table with other tables and other updates do not require any other tables. for example:

 ----update without joins to other table
UPDATE trans set COLUMN1 = 'XYZ' WHERE COLUMN2 = 'ABC'

--update with join to tabl1
UPDATE trans set trans.column2 = table1.column3
FROM trans INNER JOIN table1 on trans.column1 = table1.column2

--update with join to table2
UPDATE trans set trans.column2 = table2.column3
FROM trans INNER JOIN table2 on trans.column1 = table2.column2
instead of using the above 3 joins, i am thinking why not use a single update statement and use a left join to perform the same operation? is this is the right way of thinking in the t-sql world?  I appreciate the help in advance!

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>