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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 suggest me update query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kirank
Yak Posting Veteran

USA
58 Posts

Posted - 02/28/2013 :  04:43:56  Show Profile  Visit kirank's Homepage  Reply with Quote
Hi,

Please suggest me on update query.

i want to update #tempbulk (temp table) table. where i have two column
name,subname.

i want to update that column base on id and subid columns . below is the records in id and subid coulmns

id subid name subname
2 22
3 55

here i want to update name and subname from master table where i have mention wht is mean by 2 and 3 as id and wht is 22 and 55

i have try that below query but not proper way to solve.

UPDATE #tempbulk SET name = (select idname from masterid,#tempbulk where id = #tempbulk.id)

something like that, plz suggest



---------------------------

http://codingstuffsbykiran.blogspot.com | http://webdevlopementhelp.blogspot.com

khtan
In (Som, Ni, Yak)

Singapore
17661 Posts

Posted - 02/28/2013 :  04:52:36  Show Profile  Reply with Quote

update t
set    name    = m.idname , 
       subname = m.idsubname
from   #tempbulk t
       inner join masterid m on t.id = m.id



KH
Time is always against us

Go to Top of Page

kirank
Yak Posting Veteran

USA
58 Posts

Posted - 02/28/2013 :  05:11:13  Show Profile  Visit kirank's Homepage  Reply with Quote
Thank you it works for me. :)

---------------------------

http://codingstuffsbykiran.blogspot.com | http://webdevlopementhelp.blogspot.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000