存储过程错误求解
错误消息是:
消息 107,级别 16,状态 2,过程 DATA_IMPORT,第 395 行
列前缀 'a' 与查询中所用的表名或别名不匹配。
出错的SQL单独运行没有任何问题
SQL语句如下:
INSERT INTO ch_land
(land_id, 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 b.big_land_id, 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, GETDATE(),
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 = @inCaseNumber
AND a.land_id = b.land_id
AND b.att_mod = 3)
------解决方案--------------------INSERT INTO ch_land(land_id
,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 b.big_land_id,
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,
GETDATE(),
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 AS a WITH(NOLOCK),
TMP_LAND AS b WITH(NOLOCK)
WHERE a.case_number = @INCASENUMBER
AND a.land_id = b.land_id
AND b.att_mod = 3)
过程 DATA_IMPORT,第 395 行
是不是没有粘贴完哦,没有395行
------解决方案--------------------sorry
一、在查询分析器中新建一空白查询页,按ctrl+G输入行数
---将sql拷到这个新页中再...
------解决方案--------------------SELECT b.big_land_id, 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,&n