请问这个SQL存储过程错在哪里,报错“将截断字符串或二进制数据。”
CREATEPROCEDUREgetscore1@stuIDchar(10),@paperIDchar(10)ASinsertintoTestScoreselecta.s...
CREATE PROCEDURE getscore1
@stuID char(10) ,
@paperID char(10)
AS
insert into TestScore
select a.stuID,a.stuName,a.paperID,a.IP,a.beginTime,a.subTime,
( (case when a.q1=b.q1 then 1 else 0 end)+
(case when a.q2=b.q2 then 1 else 0 end)+
(case when a.q3=b.q3 then 1 else 0 end)+
(case when a.q4=b.q4 then 1 else 0 end)+
(case when (a.qv1a=b.qv1a)and(a.qv1b=b.qv1b)and(a.qv1c=b.qv1c)and(a.qv1d=b.qv1d) then 1 else 0 end)+
(case when (a.qv2a=b.qv2a)and(a.qv2b=b.qv2b)and(a.qv2c=b.qv2c)and(a.qv2d=b.qv2d) then 1 else 0 end))*100/6,
a.q1,a.q2,a.q3,a.q4,a.qv1a+a.qv1b+a.qv1c+a.qv1d as 'qv1',a.qv2a+a.qv2b+a.qv2c+a.qv2d as 'qv2'
from TestStuAsw a inner join TestPapAsw b on a.paperID=b.paperID
where a.stuID=@stuID and a.paperID=@paperID
delete TestSutAsw
GO 展开
@stuID char(10) ,
@paperID char(10)
AS
insert into TestScore
select a.stuID,a.stuName,a.paperID,a.IP,a.beginTime,a.subTime,
( (case when a.q1=b.q1 then 1 else 0 end)+
(case when a.q2=b.q2 then 1 else 0 end)+
(case when a.q3=b.q3 then 1 else 0 end)+
(case when a.q4=b.q4 then 1 else 0 end)+
(case when (a.qv1a=b.qv1a)and(a.qv1b=b.qv1b)and(a.qv1c=b.qv1c)and(a.qv1d=b.qv1d) then 1 else 0 end)+
(case when (a.qv2a=b.qv2a)and(a.qv2b=b.qv2b)and(a.qv2c=b.qv2c)and(a.qv2d=b.qv2d) then 1 else 0 end))*100/6,
a.q1,a.q2,a.q3,a.q4,a.qv1a+a.qv1b+a.qv1c+a.qv1d as 'qv1',a.qv2a+a.qv2b+a.qv2c+a.qv2d as 'qv2'
from TestStuAsw a inner join TestPapAsw b on a.paperID=b.paperID
where a.stuID=@stuID and a.paperID=@paperID
delete TestSutAsw
GO 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询