#Update
Used to update data in a table.
-- one table
update st_wo
set dtScheduled=null
where st_wo.id in
(
select ID from st_wo
where crewid=143
and dtClosed is null
)
-- multiple sources associated with update
update pm_task
set task_staff_username=staff.username
from pm_task,
staff
where pm_task.task_staffid=staff.id
and task_staffid is not null
go
update wa
set saddresscode='ADR000286626', addressischanged=1
from woserviceaddress wa
left join workorder as wo on wa.wonum = wo.wonum
where parent ='2160019'
-- update with multiple tables (or sources) involved.
Update x
set name=b.name
from x,
opendatasource('sqloledb', 'data source=svr; user id=x; password=x').dbo.sewer.x b
where x.uid=b.uid
go