2024-11-07 19:56:52
-- 先更改A表中列的数据类型
ALTER TABLE A ALTER COLUMN address_ID VARCHAR(128)
-- 开始联接查询,条件更新
UPDATE a
SET a.address_ID = b.addressname
FROM a, b
WHERE a.address_ID = b.address_ID
SELECT * FROM a
2024-11-07 20:44:26
2024-11-07 15:13:38
update A set A.address_id = B.addressname where A.address_id=B.address_id
为什么报错啊
能留个联系方式吗 详谈~~
不好意思,没验证。现在把经过验证的给你。在sql2000,2005,2008上通过
UPDATE a
SET address_id = c.addressname
FROM a INNER JOIN
(SELECT address_id, addressname
FROM b) AS c ON a.address_id = c.address_id
绝对不报错。
注意a表address_id 为字符型,且宽度足够
2024-11-07 15:08:18
2024-11-07 10:49:07
update A set A.address_id = B.addressname where A.address_id=B.address_id
为什么报错啊
能留个联系方式吗 ? 详谈~~
我晕,纯属失误,这句应该没问题了
update a set a.address_ID = b.addressname from a,b where a.address_ID = b.address_ID