Solved

Need some help on update

Posted on 2006-11-23
2
218 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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

776 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