Reputation: 35
I know subquery return more than 1 value but I don't know how to change the code. Can anyone help me ?
declare @sProjectNumber nvarchar(200)
( select Project from Project_Table where Project in (
select case
when @sProject is null then (select distinct Project from Project_Table)
else @sProject end
from Project_Table)
)
Upvotes: 0
Views: 46
Reputation: 1269933
I am guessing that you really intend something like this:
select Project
from Project_Table
where @sProject is NULL or Project = @sProject;
This will return the project in @sProject
or all projects if that value is NULL
.
Upvotes: 1