The multi-part identifier --could not be bound

  • Hi,

    i'm trying to update one database from another database and using sql server 2005.

    UPDATE [ClientAdmin].[dbo].[ClientTbl_DimStores]

    SET [Longitude] = [KBAdminTemp].[dbo].[mstStores].[Longitude]

    ,[Latitude] = [KBAdminTemp].[dbo].[mstStores].[Latitude]

    WHERE [ClientAdmin].[dbo].[ClientTbl_DimStores].[StoreId]=[KBAdminTemp].[dbo].[mstStores].[StoreCode]

    getting the error:

    The multi-part identifier "KBAdminTemp.dbo.mstStores.StoreCode" could not be bound.

    can anyone resolve this when you parse the query it doesnot give any error but when you execute the query it gives error

  • Nowhere in the code do you have a reference in a FROM clause to the KBAdminTemp.dbo.mstStores table so SQL cannot identify it. You either need to put the table in a FROM or do a sub-query in the WHERE clause.

  • see if this works:

    UPDATE c SET

    [Longitude] = a.[Longitude]

    ,[Latitude] = a.[Latitude]

    FROM [ClientAdmin].[dbo].[ClientTbl_DimStores] c

    INNER JOIN [KBAdminTemp].[dbo].[mstStores].[Latitude] a

    ON c.[StoreId]=a.[StoreCode]

    .

  • Thanks Mr. Jack Corbett and Mr.Jacob Sebastian,

    I understood the error and used Mr. Jacob's code.

    and its working fine.

    Thanks,

    Regards,

    Viji

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply