I try this, but the SwitchCase can not return more than one value.
WHERE CP.NumIntAut IN (
CASE WHEN @NumIntAut IS NOT NULL
THEN (@NumIntAut)
ELSE (SELECT NumIntAut FROM @TAB_NumIntAut) END)
How can I do?
sql server
I try this, but the SwitchCase can not return more than one value.
WHERE CP.NumIntAut IN (
CASE WHEN @NumIntAut IS NOT NULL
THEN (@NumIntAut)
ELSE (SELECT NumIntAut FROM @TAB_NumIntAut) END)
How can I do?
Best Answer
I think you are looking to do something like this
Assuming that I understand your question correctly. But it is worth noting that it will return the value @NumIntAut for every record in the @TAB_NumIntAut table if it not NULL. Which may or may not be what you are looking for.