Solved

Need some help on update

Posted on 2006-11-23
2
234 Views
Last Modified: 2008-03-04
I have a temp table with a field fname and email.
and I need to update my tbl_user with the fname from the temp table where the email matches the email from the temp table.

here is my SQL

update tbl_user set fname =
(select fname from tbl_temp where tbl_temp.email = tbl_user.email)
where tbl_user.email = tbl_temp.email

and I'm getting an error

Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "tbl_temp.email" could not be bound.
0
Comment
Question by:Ennio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18004254
update tu set fname =  tt.fname
from tbl_user tu
inner join tbl_temp on tbl_temp.email = tbl_user.email
where tbl_user.email = tbl_temp.email
0
 
LVL 14

Accepted Solution

by:
mherchl earned 500 total points
ID: 18004258
update tbl_user set fname = tbl_temp.fname
from tbl_user
join tbl_temp on tbl_temp.email = tbl_user.email
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question