“当前命令发生了严重错误。应放弃任何可能产生的结果。”这个错误是在我执行一个存储过程的时候出现的。至今我还是不晓得是什么原因导致的。。
存储过程如下:CREATE procedure pr_xkd @date date as
begin
with tt(vip_id) as
(
select vip_id from luo_temp where convert(date,order_time)=@date
except
select user_id from orderall oa where CONVERT(date,add_time)<@date
and oa.order_type in ('2','3','4','5') and oa.money + oa.surplus>0)
update luo_temp set vip_flag=2from luo_temp lt join tt on lt.vip_id=tt.vip_id
where convert(date,lt.order_time)=@date and convert(date,vip_time)<>convert(date,order_time)
end
存储过程如下:CREATE procedure pr_xkd @date date as
begin
with tt(vip_id) as
(
select vip_id from luo_temp where convert(date,order_time)=@date
except
select user_id from orderall oa where CONVERT(date,add_time)<@date
and oa.order_type in ('2','3','4','5') and oa.money + oa.surplus>0)
update luo_temp set vip_flag=2from luo_temp lt join tt on lt.vip_id=tt.vip_id
where convert(date,lt.order_time)=@date and convert(date,vip_time)<>convert(date,order_time)
end
convert(date,lt.order_time)=@date
--什么意思?
建議用通用的方法來編寫SP