Steve7423
asked on
Select Case error "Incorrect syntax near = "
I can never seem to get case statements right. Object of game,
If PPS.intStage_Number % 2 is even then leave the Proc_Pkg_ID as it is
If PPS.intStage_Number % 2 is odd then increment the Proc_Pkg_ID by 1
I’m getting the error Incorrect syntax near ‘=’ on the line PP.Proc_Pkg_ID =
I need a hand with getting the syntax right
Declare @CurrStageNo int
Declare @NextStageNo int
Declare @StageResult int
--Testing----------------- ------
Declare @Proj_ID int
Declare @Val varchar(20)
-------------------------- ------
set @Proj_ID = 2
set @Val = '1400270182RS'
SELECT
PI.Proj_Item_ID,
PP.Proc_Pkg_ID =
case PPS.intStage_Number
when PPS.intStage_Number % 2 = 0 then PP.Proc_Pkg_ID + 1
else PP.Proc_Pkg_ID
end
FROM tbl_Projects_PackagesStage PPS
INNER JOIN tbl_Process_Packages PP ON PPS.Proc_Pkg_ID = PP.Proc_Pkg_ID
INNER JOIN tbl_Package_Stages PPS ON PPS.ProcPkg_Stage_ID = PPS.ProcPkg_Stage_ID
INNER JOIN tbl_Projects_Information PI ON PPS.Proj_Item_ID = PI.Proj_Item_ID
Where
PI.Proj_ID = @Proj_ID
AND PI.sItem_Number = @Val
AND PPIST.bActive = 1
Order by PPS.intStage_Number Desc
If PPS.intStage_Number % 2 is even then leave the Proc_Pkg_ID as it is
If PPS.intStage_Number % 2 is odd then increment the Proc_Pkg_ID by 1
I’m getting the error Incorrect syntax near ‘=’ on the line PP.Proc_Pkg_ID =
I need a hand with getting the syntax right
Declare @CurrStageNo int
Declare @NextStageNo int
Declare @StageResult int
--Testing-----------------
Declare @Proj_ID int
Declare @Val varchar(20)
--------------------------
set @Proj_ID = 2
set @Val = '1400270182RS'
SELECT
PI.Proj_Item_ID,
PP.Proc_Pkg_ID =
case PPS.intStage_Number
when PPS.intStage_Number % 2 = 0 then PP.Proc_Pkg_ID + 1
else PP.Proc_Pkg_ID
end
FROM tbl_Projects_PackagesStage
INNER JOIN tbl_Process_Packages PP ON PPS.Proc_Pkg_ID = PP.Proc_Pkg_ID
INNER JOIN tbl_Package_Stages PPS ON PPS.ProcPkg_Stage_ID = PPS.ProcPkg_Stage_ID
INNER JOIN tbl_Projects_Information PI ON PPS.Proj_Item_ID = PI.Proj_Item_ID
Where
PI.Proj_ID = @Proj_ID
AND PI.sItem_Number = @Val
AND PPIST.bActive = 1
Order by PPS.intStage_Number Desc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There was additional information that needed to be included in order to complete the solution.
Thanks for the grade. Good luck with your project. -Jim
ASKER