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.
Author |
Topic |
kirank
Yak Posting Veteran
58 Posts |
Posted - 2012-05-11 : 14:16:24
|
hi , i know its simple but can you plz help me in this query.below is my temp table and i want to update tempname field from another table(temp_name)how i can write a query to check that temmpid on temp_name table and base on that retrieve thetempname and add into the #tempbulk table.UPDATE #tempbulk SET tempname= a.tempnamewhere temp_name.temmpid == tempbulk.tempidsomething kind of , plz correct me.Thankxhttp://webdevlopementhelp.blogspot.com |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-05-11 : 15:03:21
|
Assuming your source tablename is temp_name and the target table name is #tempBulk then:UPDATE #tempBulk SET tempname= temp_name.tempnameFROM temp_name INNER JOIN #tempBulk ON temp_name.temmpid = #tempBulk.tempid Edit: But please pay close attention to the table names and column names. Is one table a temp table (that has a name starting with #) and the other a base table (with a name that does not start with #). Also, is the column name temmpid in one table and tempid in the other? |
 |
|
|
|
|