string update in sqlserver
- by Thiyaneshwaran S
Currently i have varchar field. The delimiter is "$P$P$".
The delimiter will appear atleast once and atmost 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?