Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error using temporary table

Status
Not open for further replies.

junkmail

Programmer
Jan 7, 2001
134
US
Can someone tell me why I get the following error with the code provided?

Msg 4104, Level 16, State 1, Procedure sp_Test, Line 20
The multi-part identifier "#temp.id" could not be bound.

select * into #temp from billtrack where id in(select min(id) from billtrack
group by customer )
update billtrack
set test = 1
where #temp.id = billtrack.id
 
You should JOIN the table:
Code:
select * into #temp from billtrack where id in(select min(id) from billtrack
group by customer )

update billtrack set test = 1
FROM billtrack
INNER JOIN #temp.id = billtrack.id

Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top