String update in SQL Server
Posted
by Thiyaneshwaran S
on Stack Overflow
See other posts from Stack Overflow
or by Thiyaneshwaran S
Published on 2010-06-09T18:15:36Z
Indexed on
2010/06/09
19:12 UTC
Read the original article
Hit count: 166
Currently I have varchar
field. The delimiter is "$P$P$".
The delimiter will appear at least once and at most twice in the varchar
data.
Eg.
Sample Heading$P$P$Sample description$P$P$Sample conclusion
Sample Heading$P$P$Sample Description
If the delimiter appears twice, I need to insert a text before the second occurance of the delimiter.
Eg:
Sample Heading$P$P$Sample DescriptionINSERT TEXT HERE$P$P$Sample Conclusion
If the delimiter occurs only once, then I need to insert a text at the end of the field.
Eg:
Sample Heading$P$P$Sample DescriptionAPPEND TEXT HERE
How this can be done in SQL query?
© Stack Overflow or respective owner