Updating non PK fields in SQL Server 2008 -
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
Post a Comment