Drop the SET and do the assignment as part of the select
declare @sequence_number int
select @sequence_number =
when workflow_activity_type_identifier = 197 then '1'
case when workflow_activity_type_identifier = 203 then '1'
where workflow_activity_type_identifier in (200,201)
and workflow_activity_identifier = @workflow_activity_identifier
Just be warned, if there's more than 1 row in the workflow_activity table, it's not easy to say which row will be the one evaluated for the variable.
What, exactly, are you trying to do with this statement?
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass