set identity_insert B onupdate Bset userid = A.useridfrom A,B where --加上语句set identity_insert B off不过奇怪,你的B表中的userid怎么会是自增长呢?