Skip to content
Advertisement

Copy data from one column to other column (which is in a different table and different database)

I want to copy one table column value to another table. But both are in different databases. I did this but

UPDATE dbo.Excelimp.Furniture
SET dbo.Excelimp.Furniture.AssetId = dbo.Sample.FADetailsNew.AssetNo
FROM dbo.Excelimp.Furniture 
JOIN Sample
ON dbo.Excelimp.Furniture.AssetName=dbo.Sample.FADetailsNew.AssetName

but it seems the error

Invalid object name ‘dbo.Excelimp.Furniture’.

Advertisement

Answer

No Need of writing schema with column name you can write as below also

UPDATE T1
SET T1.AssetId = T2.AssetNo
FROM Excelimp.Furniture T1
JOIN Sample.FADetailsNew T2
ON T1.AssetName=T2.AssetName
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement