October 8, 2008 at 6:58 am
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
October 8, 2008 at 8:09 am
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.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 8, 2008 at 8:18 am
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]
.
October 9, 2008 at 9:24 pm
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