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
 General SQL Server Forums
 New to SQL Server Programming
 suggest me update query

Author  Topic 

kirank
Yak Posting Veteran

58 Posts

Posted - 2013-02-28 : 04:43:56
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)

17689 Posts

Posted - 2013-02-28 : 04:52:36
[code]
update t
set name = m.idname ,
subname = m.idsubname
from #tempbulk t
inner join masterid m on t.id = m.id
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

kirank
Yak Posting Veteran

58 Posts

Posted - 2013-02-28 : 05:11:13
Thank you it works for me. :)

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

http://codingstuffsbykiran.blogspot.com | http://webdevlopementhelp.blogspot.com
Go to Top of Page
   

- Advertisement -