armangara
سه شنبه 17 شهریور 1388, 10:29 صبح
سلام
من يه stored prosedureدارم كه ميخوام تو قسمت where اون يه عبارت if else بزارم اما رو if
خطا ميده ميخوام ببينم اصلا ميشه اونجا if ya case گذاشت يا نه؟
where
--e.crt=case @dahande when 1 then 1 end
--e.deb is not null
--andhvl
(edate >=@Oxdate or @Oxdate is null ) and ( edate <=@Oydate or @Oydate is null ) and gpidref = isnull(@g,gpidref)
and ( edate >=@Dxdate or @Dxdate is null ) and ( edate <=@Dydate or @Dydate is null )
and klidref = isnull(@k,klidref)
and isnull(mnidref,'') = isnull(@m,isnull(mnidref,''))
and isnull(tfidref,'') = isnull(@t,isnull(tfidref,''))
and cheqAcc.idcheq=@idcheq and
if @girande
e.deb is not null
else if @dahande
begin
e.crt is not null
end
من يه stored prosedureدارم كه ميخوام تو قسمت where اون يه عبارت if else بزارم اما رو if
خطا ميده ميخوام ببينم اصلا ميشه اونجا if ya case گذاشت يا نه؟
where
--e.crt=case @dahande when 1 then 1 end
--e.deb is not null
--andhvl
(edate >=@Oxdate or @Oxdate is null ) and ( edate <=@Oydate or @Oydate is null ) and gpidref = isnull(@g,gpidref)
and ( edate >=@Dxdate or @Dxdate is null ) and ( edate <=@Dydate or @Dydate is null )
and klidref = isnull(@k,klidref)
and isnull(mnidref,'') = isnull(@m,isnull(mnidref,''))
and isnull(tfidref,'') = isnull(@t,isnull(tfidref,''))
and cheqAcc.idcheq=@idcheq and
if @girande
e.deb is not null
else if @dahande
begin
e.crt is not null
end