现在我有两张表分别是S_PERSON,S_USER
S_PERSON
S_USER
我现在想把S_USER表中的ACCOUNT批量修改成S_PERSON的ACCOUNT
我们可以发现S_USER表中有个跟S_PERSON表关联的字段 那就是PERSON_ID 这也是我们要update的条件
找到这个关系以后我们就不难写sql了
update S_USER set account=p.account from S_PERSON p where p.id=S_USER.person_id;
结
修改: 代码如下: declare proccur cursor for select [name] from sysobjects where name like ‘Foods_%’ declare procname varchar(100) declare temp varchar(100) open proccur fetch next from proccur into procname while(FETCH_STATUS = 0) begin set temp=’kcb_’+pro