robthomas09
asked on
SQL - substring query assistance
Hi experts,
I am trying to write a query that replaces the very first instance of the word 'Cath' in a string, with the word 'Echo'.
So far I have:
update card_proceduresextpop_
set reportdisplay = REPLACE(SUBSTRING(reportdi splay, 1, CHARINDEX(reportdisplay,'E cho',1)), 'Echo', 'Cath')
, SUBSTRING(reportdisplay, CHARINDEX(reportdisplay,'E cho',1)+1, LEN(reportdisplay))
FROM card_proceduresextpop_
where procedureabbr = 'Echo'
and substring(reportdisplay, 1, 4) = 'Echo'
but it gives me an error:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ','.
Any ideas?
Thanks
I am trying to write a query that replaces the very first instance of the word 'Cath' in a string, with the word 'Echo'.
So far I have:
update card_proceduresextpop_
set reportdisplay = REPLACE(SUBSTRING(reportdi
, SUBSTRING(reportdisplay, CHARINDEX(reportdisplay,'E
FROM card_proceduresextpop_
where procedureabbr = 'Echo'
and substring(reportdisplay, 1, 4) = 'Echo'
but it gives me an error:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ','.
Any ideas?
Thanks
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