tsql : how to do a substring replace?
Posted
by phill
on Stack Overflow
See other posts from Stack Overflow
or by phill
Published on 2010-03-22T16:31:03Z
Indexed on
2010/03/22
16:41 UTC
Read the original article
Hit count: 328
goal: I have the string "1234432144" I want to only replace the first 2 4's with '10' so I would get '1231032144'
Is there a way to do this in tsql?
so far I have come up with the tsql substring() function
substring('1234432144', 4, 2)
which draws the 44 .. however how do i replace it within the existing string?
If i wrap a replace function around it, it replaces all occurrences of 44 in the string.
any ideas?
thanks in advance.
© Stack Overflow or respective owner