sql存储过程数据类型 varchar 和 varchar 在 modulo 运算符中不兼容。
if(@sql='')beginselectodno,odmaifang,odmaifangdizhi,odmaifangyoubian,odmaifanglianxir...
if(@sql='')
begin
select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate =@type and kh_id = odmaifangfk)and((odno like '%'+ @odno +'%' or @odno='')and(kh_name like '%'+ @kh_name +'%' or @kh_name=''))
end
else
begin
set @sql=' select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate =@type and kh_id = odmaifangfk)and((odno like '%'+ @odno +'%' or @odno='')and(kh_name like ''%''+ @kh_name +''%'' or @kh_name='') and '+@sql+')'
exec(@sql)
end
END 展开
begin
select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate =@type and kh_id = odmaifangfk)and((odno like '%'+ @odno +'%' or @odno='')and(kh_name like '%'+ @kh_name +'%' or @kh_name=''))
end
else
begin
set @sql=' select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate =@type and kh_id = odmaifangfk)and((odno like '%'+ @odno +'%' or @odno='')and(kh_name like ''%''+ @kh_name +''%'' or @kh_name='') and '+@sql+')'
exec(@sql)
end
END 展开
3个回答
展开全部
sql存储过程数据类型 varchar 和 varchar 在 modulo 运算符中不兼容。
这个问题我知道
推荐您使用“赛思QQ陌生人推广小助手 ”
不用加好友 直接发消息
日引1万独立IP 绝对没有问题
这个问题我知道
推荐您使用“赛思QQ陌生人推广小助手 ”
不用加好友 直接发消息
日引1万独立IP 绝对没有问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
啥意思,啥问题,看不明白。
不过,else里面的语句,有问题,修改后如下:
set @sql=' select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate = ‘ + @type + ’ and kh_id = odmaifangfk)and((odno like ‘’'%'+ @odno +'%‘’ or ‘ + @odno + ’ ='‘’' )and(kh_name like ‘''%'+ @kh_name +'%'’ or ‘ + @kh_name + ’ =‘’'') and '+@sql+')'
不过,else里面的语句,有问题,修改后如下:
set @sql=' select odno, odmaifang, odmaifangdizhi, odmaifangyoubian, odmaifanglianxiren, odshouhuodizhi, odmaifangdianhua, odshouhuoren, odtizhongleibie,odmaifangchuanzhen, odmaifangemail, odmaifangkaihuhang, odmaifangzhanghao, odmaifangnsdjh, odmaifangfk, gc_remark, odyunfei, odremark, odzengzhishui, odjiasuiheji, odstate, odshenpisate ,kh_name,kh_postcode,kh_contact1,kh_contact1_tel,kh_address1,kh_bank,kh_bankaccount,kh_tax,kh_fax from dbo.kh_custbasic as c , BJ_OrderManage T , dbo.Global_Config as b
where (b.gc_type=90 and b.gc_remark1 = T.odkaipiaoleixing and T.orderstate = ‘ + @type + ’ and kh_id = odmaifangfk)and((odno like ‘’'%'+ @odno +'%‘’ or ‘ + @odno + ’ ='‘’' )and(kh_name like ‘''%'+ @kh_name +'%'’ or ‘ + @kh_name + ’ =‘’'') and '+@sql+')'
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
exec 之前加一个print @sql看下里面内容
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询