我有SQL server SP,它将数据从临时网格移动到主网格。此过程的主要目的是实现上载过程以从临时网格移动数据,并在移动到主网格时从临时网格中删除行。希望我已经清楚地解释了这个要求。 到目前为止我已经做到了这一点,但我最终得到的错误很少。我的方法是正确的还是我偏离了目的地。有人可以建议一个解决方法。
由于
代码:
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script>
<div v-for="message in decodedMessages">
{{message}}
</div>
答案 0 :(得分:2)
在存储过程中声明结束时有一个悬空的逗号。这是您的一个错误问题。
答案 1 :(得分:-1)
我这样做了,查询运行良好:
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
declare @starting_row_index as integer=0,
@ncolumn_index as integer=0,
@sresponse_string as varchar(4000),
@srepsonse_stringm as varchar(4000),
@response_stringo as varchar(4000),
@nFY_ST_QUESTION_DTL_TABLE_ID as numeric(38,0);
select qd.FY_ST_QUESTION_DTL_TABLE_ID
from FY_ST_QUESTION_DETAIL qd inner join FY_ST_QUESTION_INFO qi
on qd.FY_ST_QUESTION_INFO_TABLE_ID = qi.FY_ST_QUESTION_INFO_TABLE_ID
where qi.region = @cRegion
and qi.state_code = @cState_Code
and qi.fy = @nFY
and qi.report_id = @nREPORT_ID
and qi.section_id = @nSECTION_ID
and qi.subsection_id = @nSUBSECTION_ID
and qi.display_number = @nDISPLAY_NUMBER
and qi.QUESTION_NUMBER = @nQUESTION_NUMBER
and ( QI.REPORTER_ID = @sUSER_ID or
QI.DELEGATE_ID = @suser_id or
QI.SUB_DELEGATE_ID = @suser_id )
and QD.QUESTION_PART_NUMBER = @nQUESTION_PART_NUMBER;
set @ncolumn_index=
case
when (@nREPORT_ID = 1 and @nQUESTION_NUMBER = 21) then 17
when (@nREPORT_ID = 1 and @nQUESTION_NUMBER = 32) then 16
when (@nREPORT_ID = 3 and @nQUESTION_NUMBER = 11) then 15
when (@nREPORT_ID = 3 and @nQUESTION_NUMBER = 12) then 27
end;
if(@nFY_ST_QUESTION_DTL_TABLE_ID >0)
begin
if( @nIsMerge = 'Y')
Begin
select (max(ad.ROW_NUMBER))
from FY_ST_ANSWER_DETAIL as ad
where ad.FY_ST_QUESTION_DTL_TABLE_ID=@nFY_ST_QUESTION_DTL_TABLE_ID;
end
else
begin
delete ad from FY_ST_ANSWER_DETAIL ad
where ad.fy_st_question_dtl_table_id = @nFY_ST_QUESTION_DTL_TABLE_ID;
end
-- --if(@nFY_ST_QUESTION_DTL_TABLE_ID >0)
-- --begin
insert into FY_ST_ANSWER_DETAIL (FY_ST_QUESTION_DTL_TABLE_ID, REGION, STATE_CODE, FY, REPORT_ID, SECTION_ID, SUBSECTION_ID,
DISPLAY_NUMBER, QUESTION_NUMBER, QUESTION_PART_NUMBER, row_number, COLUMN_NUMBER, LAST_UPDATE_USERID, LAST_UPDATE_TIME, RESPONSE_STRING)
select FY_ST_QUESTION_DTL_TABLE_ID, REGION, STATE_CODE, FY, REPORT_ID, SECTION_ID, SUBSECTION_ID, DISPLAY_NUMBER, QUESTION_NUMBER, QUESTION_PART_NUMBER, row_number, COLUMN_NUMBER, LAST_UPDATE_USERID, LAST_UPDATE_TIME, RESPONSE_STRING
from upload_temp_data
where FY_ST_QUESTION_DTL_TABLE_ID = @nFY_ST_QUESTION_DTL_TABLE_ID and
COLUMN_NUMBER <= @ncolumn_index;
end
else
begin
DELETE ul FROM UPLOAD_TEMP_DATA UL
WHERE UL.FY_ST_QUESTION_DTL_TABLE_ID = @nFY_ST_QUESTION_DTL_TABLE_ID;
end