I have two identical tables in two different databases with the same data but they have different primary keys, I need to update these so they have the same key, so what I did was making sure that none of the tables had any key in common and that there were no duplicates
UPDATE db1.dbo.Table
SET db1.dbo.Table.pcol = rightPcol.pcol
FROM db1.dbo.Table
JOIN db2.dbo.Table AS rightPcol ON db1.dbo.Table.2ndIdent = db2.dbo.Table.2ndIdent
this however results in "Violation of PRIMARY KEY Constraint. Cannot insert duplicate key in object"
when adding a where clause to not update any db1 pcol value that existed in the db2 pcol it didn't update anything at all, it does look like it tries to update with the primary key in db1 instead of db2.
any and all help is greatly appreciated!
//fixed minor spelling error :)