set @varState2=(select state2 from oa_email where id=@varId) 好象应该改成select @varState2=(select state2 from oa_email where id=@varId),还有,如果(select state2 from oa_email where id=@varId)返回的不是一条记录。肯定报错。
我只用过 select @varstate2=state2 from oa_email where id=@varId 返回的不是一条记录也没关系,得到的是最后一条纪录.
谢谢yangzi和orient,为两位送上10分,别说我小气哦^_^ 我不明白的是我的ID是唯一的,结果应该只能返回一个值的, 为什么在执行的时候也报子查寻返回多个值的错误?? ================================== Server: Msg 512, Level 16, State 1, Procedure p_email_update, Line 6 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.
select @varstate2=state2
from oa_email
where id=@varId
返回的不是一条记录也没关系,得到的是最后一条纪录.
我不明白的是我的ID是唯一的,结果应该只能返回一个值的,
为什么在执行的时候也报子查寻返回多个值的错误??
==================================
Server: Msg 512, Level 16, State 1, Procedure p_email_update, Line 6
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.