Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server T-SQL Replace

I have a case statement where I am trying to change two values from a field.

CASE
WHEN prod_map.Product_ID1 = 'CR'  
THEN REPLACE(REPLACE(cl.trade_day_count, 'ACT','ACTUAL'),cl.trade_day_count, 
'ACT+1', 'ACTUAL')
END,

so, when cl.trade_day_count contains the value 'ACT' or 'ACT+1' then change to 'ACTUAL'

like image 594
Iasha Avatar asked Feb 28 '26 17:02

Iasha


1 Answers

Working answer from Alex K. comment:

REPLACE(REPLACE(cl.trade_day_count, 'ACT','ACTUAL'),'ACTUAL+1', 'ACTUAL')
like image 60
Scath Avatar answered Mar 02 '26 15:03

Scath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!