--三個SQL結果相同
select DETL_BAT_FIELD from rpt_head
where RP_TEMPLET in (3,4) and isnull(DETL_BAT_FIELD,'')<>'' and COM_NO='00'
declare @rp_templet varchar(10)
set @rp_templet='3,4'
select DETL_BAT_FIELD from rpt_head
where CharIndex(','+RP_TEMPLET+',',','+@rp_templet+',')>0 and isnull(DETL_BAT_FIELD,'')<>'' and COM_NO='00'
set @rp_templet='''3'',''4'''
select DETL_BAT_FIELD from rpt_head
where CharIndex(','''+RP_TEMPLET+''',' , ','+@rp_templet+',')>0 and isnull(DETL_BAT_FIELD,'')<>'' and COM_NO='00'
in的用法
最新推荐文章于 2022-05-18 17:27:35 发布