The code below works fine if sopnumbe is null it then uses order_num and populates master_sop_num with order_num. But I am also trying to achieve the reverse. If order_num is null then use sopnumbe and populate master_sop_num. I am not too go with syntax.
Thanks, much appreciated.
Thanks, much appreciated.
Code:
select
case
when sopnumbe is null
then cast(order_num as char(21))
else sopnumbe
end as master_SOP_Num,