Updating non PK fields in SQL Server 2008 -


enter image description here

my maintable has column primarycode. these codes incorrect , need updated based on updatecodes table. incorrect codes in column primarycode on maintable , primarycode on updatecodes table. descrip column correct version. since i'm not sure how rollback works, below query fixing problem; think it's right, not sure.

edit: there many more codes in maintable these. these ones need updated. don't know if affect query or not.

update maintable set maintable.primarycode=update.descrip maintable inner join updatecodes on maintable.primarycode=updatecodes.descrip 

how this:

update maintable set maintable.primarycode = updatecodes.descrip maintable inner join updatecodes  on maintable.primarycode = updatecodes.primarycode 

joining on values "wrong" correct ones update...


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -