Error multi-part identifier could not be bound on UPDATE Statement

  • 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

    🙂

  • 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

  • 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