使用存储过程,根据条件查询一张table_a表的数据,然后插入到临时表#MxTemp,再返回
我调试好多次了,就是不成功
if @rpt_type = '01'
begin
insert into #MxTemp(card_id,merchant_id,wz_id,dept_id,czry_id,machine_id,cardtype_id,iccardtype_id,cardhard_id,[user_name]
,user_xb,user_address,user_tel,user_password,user_company,zjbh,zjlx,school,nj,sktime,sendbz,hztime,inputfilename
,operate_id,outpc,ybz1,ylbz2)
select card_id,merchant_id,wz_id,dept_id,czry_id,machine_id,cardtype_id,iccardtype_id,cardhard_id,[user_name]
,user_xb,user_address,user_tel,user_password,user_company,zjbh,zjlx,school,nj,sktime,sendbz,hztime,inputfilename
,operate_id,outpc,ylbz1,ylbz2
from table_a
where cardhard_id like '%'+ @cardhard_id +'%'
and iccardtype_id like '%'+ @iccardtype_id +'%' and
[user_name] like '%'+ @user_name +'%' and cardtype_id like '%'+ @cardtype_id +'%'and
sktime >= @qsrq and @zzrq >= sktime
begin
select * from #MxTemp
end
end
大神帮忙看看哪错了,谢谢!
SQL 存储过程
------解决方案--------------------
if @rpt_type = '01'
begin
insert into #MxTemp(card_id,merchant_id,wz_id,dept_id,czry_id,machine_id,cardtype_id,iccardtype_id,cardhard_id,[user_name]
,user_xb,user_address,user_tel,user_password,user_company,zjbh,zjlx,school,nj,sktime,sendbz,hztime,inputfilename
,operate_id,outpc,ybz1,ylbz2)
select card_id,merchant_id,wz_id,dept_id,czry_id,machine_id,cardtype_id,iccardtype_id,cardhard_id,[user_name]
,user_xb,user_address,user_tel,user_password,user_company,zjbh,zjlx,school,nj,sktime,sendbz,hztime,inputfilename
,operate_id,outpc,ylbz1,ylbz2
from table_a
where cardhard_id like '%'+ @cardhard_id +'%'
and iccardtype_id like '%'+ @iccardtype_id +'%' and
[user_name] like '%'+ @user_name +'%' and cardtype_id like '%'+ @cardtype_id +'%'and
sktime >= @qsrq and @zzrq >= sktime
end
select * from #MxTemp
------解决方案--------------------
看下报错信息是啥来的.