Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Multiple Rows updating

Author  Topic 

dhayasridhar
Starting Member

1 Post

Posted - 2013-05-14 : 07:58:40
i have two tables in my database table1 & table2.
Table1 have (id,country_name,country_short_name,country_code)
Table2 have (country_name,country_short_name).
So Table1 have contain lots of data and some country names are repeated in that table.
But Table1 country_short_name rows are null. So i need to update that country_short_name rows.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-14 : 08:04:27
[code]
UPDATE t1
SET t1.country_short_name = t2.country_short_name
FROM table1 t1
inner join table2 t2
on t2.country_name = t1.country_name
where t1.country_short_name is null
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -