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

Help required for update SQL

$
0
0

Hi Guys,
I am looking for some help to frame the update query.
I have two tables temp_1 and temp_2.

I want to update temp_2 based on data from temp_1. However i do not want to make an update where temp_1 has null value.
One approach i can think of is creating two different update statements but is there any chance to get it done through
only one statement. Also i would like to add here that temP_1 has 250K data and i going to make update on approx 500K
rows from temp_2. So i need to look from performance point of view as well.

Temp_1                      temp_2
Col1   Col2  Col3       col1     col2    col3
1 abc   abc       1        null    null
2 abc   null      2         xyz     xyz
3 null  null      3          xyz     null

After update i am looking forward to get data in below format.

temp_2
col1     col2    col3
1        abc     abc
2        abc     xyz
3        xyz     null  


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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