declare @prostr nvarchar(50)
if @pro=ALL
set @prostr=
else
set @prostr= and substring(ord_no,1,1)=+ + substring(@pro,1,1)
select * from orderinf where sur_date>=@fd and sur_date<=@ed and mark<>PRO+ @prostr group by ord_no)
----------------------------------------------
上面的set @prostr= and substring(ord_no,1,1)=+ + substring(@pro,1,1)
和mark<>PRO+ @prostr
怎么写才是对的?
谢谢大家
declare @prostr nvarchar(50)
if @pro=ALL
set @prostr=
else
set @prostr= and substring(ord_no,1,1)=+substring(@pro,1,1)+
exec(select * from orderinf where sur_date>=@fd and sur_date<=@ed and mark<>PRO +@prostr+ group by ord_no))
declare @prostr nvarchar(50)
if @pro=ALL
set @prostr=
else
set @prostr= and substring(ord_no,1,1)=+ substring(@pro,1,1) +
select * from orderinf where sur_date>=@fd and sur_date<=@ed and mark<>PRO+ @prostr group by ord_no)