关于UPDATE的问题
在ORACLE中可以这样UPDATE:
UPDATE land
SET (land_number, district_code, street_code, block_code,
land_numerator, land_denominator, land_name, rw_code,
land_rights, land_use_desc, land_grade, area_cert,
area_survey, farmland_state, right_state, geo_state, state,
state_date, land_type, arcid, note, start_date,
data_state, districtid, approval_number, ref_x, ref_y,
POSITION, begin_depth, end_depth, case_number) =
(SELECT a.land_number, a.district_code, a.street_code,
a.block_code, a.land_numerator, a.land_denominator,
a.land_name, a.rw_code, a.land_rights,
a.land_use_desc, a.land_grade, a.area_cert,
a.area_survey, a.farmland_state, a.right_state,
a.geo_state, a.state, a.state_date, a.land_type,
a.land_number, a.note, a.start_date, a.data_state,
a.districtid, a.approval_number, a.ref_x, a.ref_y,
a.POSITION, a.begin_depth, a.end_depth,
a.case_number
FROM imp_land a, tmp_land b
WHERE a.case_number = incase_number
AND b.att_mod = 1
AND b.big_land_id = land.land_id
AND b.land_id = a.land_id)
SQLServer中如何实现这样的更新呢?
[解决办法]
要换成类似:
UPDATE land
SET land_number=a.land_number, district_code=a.district_code
FROM imp_land a, tmp_land b
WHERE a.case_number = incase_number
AND b.att_mod = 1
AND b.big_land_id = land.land_id
AND b.land_id = a.land_id)
这种才行
[解决办法]
update land set 'land.*'='ab.*'from imp_land a, tmp_land b WHERE a.case_number = incase_number AND b.att_mod = 1 AND b.big_land_id = land.land_id AND b.land_id = a.land_id)
[解决办法]
SQL Server使用的是T-SQL,Oracle使用的是PL/SQL,用法上相差很大。SQL Server 不支持楼主的这种做法。update更新格式类似如下:update 表A set f1 = t2.f1, f2 = t2.f2, f3 = t2.f3from 表A as t1 inner join 表B as t2 on t1.id=t.idwhere t1.name like 'sss%'