Put it in a SELECT clause ...
select *, (CASE when adsl_order_id like '95037%' then '000000'+substring(adsl_order_id,6,6) ELSE adsl_order_id END) AS Id from table where not in (select mwebID from tmp_csv_dawis_bruger0105)
In addition, you do not need to “SELECT” the CASE result.
Ian warburton
source share