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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE query multipart idnetifier error 1

Status
Not open for further replies.

vba317

Programmer
Joined
Mar 5, 2009
Messages
708
Location
US
I am using SQL 2005. My query isn't working. I keep on getting the following error. The multi-part identifier "Pd.Mon_shnm" could not be bound. I am trying to use information from the dbo.dic_Period table and put it into the dbo.rpt_FYInfo table.

Tom

Code:
UPDATE rptdata_monthly.dbo.rpt_FYInfo
set mon_shnm = pd.mon_shnm
SELECT pd.mon_shnm
FROM rptdata_monthly.dbo.dic_Period pd
INNER JOIN rptdata_monthly.dbo.rpt_FYInfo FY ON FY.rptpd = pd.pd
WHERE FY.rptpd = 391 and FY.uci='BPA' and FY.mon_shnm is null
 
Try:

Code:
UPDATE FY
set FY.mon_shnm = pd.mon_shnm
FROM rptdata_monthly.dbo.rpt_FYInfo FY 
INNER JOIN rptdata_monthly.dbo.dic_Period pd
    ON pd.pd = FY.rptpd 
WHERE 
    FY.rptpd = 391 and 
    FY.uci='BPA' and 
    FY.mon_shnm is null

Hope this helps.

[URL unfurl="true"]http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos[/url]
 
Thanks this worked like a charm. I am going to have to update another 6 fields with this concept so I really appreciate your help!

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top