December 16, 2010 at 8:31 am
I am getting an multi-part identifier could not be bound error
on both tmptblListPrices.curListPrice_Jan
dbo.tmptblListPrices.lngCategoryID
UPDATE dbo.tblBrands
SET dbo.tmptblListPrices.curListPrice_Jan = dbo.tblBrands_ListPrices.curListPrice,
dbo.tmptblListPrices.lngCategoryID = dbo.tblBrands.lngCategoryID
FROM dbo.tblBrands
INNER JOIN dbo.tmptblListPrices
INNER JOIN dbo.tblBrands_ListPrices
ON dbo.tmptblListPrices.strBrandID = dbo.tblBrands_ListPrices.strBrandID
AND dbo.tmptblListPrices.strChainCode = dbo.tblBrands_ListPrices.strChainCode
AND dbo.tmptblListPrices.intYear = dbo.tblBrands_ListPrices.intYear
AND dbo.tmptblListPrices.strDivisionCode = dbo.tblBrands_ListPrices.strDivisionCode
ON dbo.tblBrands.strBrandID = dbo.tblBrands_ListPrices.strBrandID
WHERE dbo.tblBrands_ListPrices.bytMonthID = 1
AND dbo.tblBrands_ListPrices.strDivisionCode = 10
AND dbo.tblBrands_ListPrices.intYear = 2010
🙂
December 16, 2010 at 9:25 am
You're not updating the same table you declared in the UPDATE statement.
Just change the table to update accordingly:
UPDATE dbo.tmptblListPrices
SET dbo.tmptblListPrices.curListPrice_Jan = dbo.tblBrands_ListPrices.curListPrice,
dbo.tmptblListPrices.lngCategoryID = dbo.tblBrands.lngCategoryID
FROM dbo.tblBrands
INNER JOIN dbo.tmptblListPrices
INNER JOIN dbo.tblBrands_ListPrices
ON dbo.tmptblListPrices.strBrandID = dbo.tblBrands_ListPrices.strBrandID
AND dbo.tmptblListPrices.strChainCode = dbo.tblBrands_ListPrices.strChainCode
AND dbo.tmptblListPrices.intYear = dbo.tblBrands_ListPrices.intYear
AND dbo.tmptblListPrices.strDivisionCode = dbo.tblBrands_ListPrices.strDivisionCode
ON dbo.tblBrands.strBrandID = dbo.tblBrands_ListPrices.strBrandID
WHERE dbo.tblBrands_ListPrices.bytMonthID = 1
AND dbo.tblBrands_ListPrices.strDivisionCode = 10
AND dbo.tblBrands_ListPrices.intYear = 2010
-- Gianluca Sartori
December 16, 2010 at 11:22 am
Thanks that worked. I just convert creep code from MS Access
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply