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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Multiple Rows updating
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dhayasridhar
Starting Member

India
1 Posts

Posted - 05/14/2013 :  07:58:40  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 05/14/2013 :  08:04:27  Show Profile  Reply with Quote

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


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs

Edited by - visakh16 on 05/14/2013 08:05:01
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000