i have a big t-sql stored procedure with this part that i am concerned about:
insert into @list
(
params
...
)
select params
,..
,oip.someAttr
from @list2 as O
join dbo.abc oip
on oip.id = O.id
AND oip.prgId <> 4
join .. someother tables
...
where oipr.attrA = 1232
Now i want to write a logic that want for an additional parameter in the stored procedure
“@value bit” if it is set then only the “AND condition above” should be checked otherwise not.
so if i do like
join dbo.abc oip
on oip.id = O.id
[AND]??? (i donot know).
Thanks in advance 🙂
This should do it:
AND (oip.prgId <> 4 OR @value = 0)