How to replace in sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • visweswaran2830
    New Member
    • Nov 2009
    • 92

    How to replace in sql

    let output string will be,

    str="01/Mar/2010,02/Mar/2010,03/Mar/2010,04/Mar/2010,05/Mar/2010"

    Some manipulation, *******

    Resultant string should be,

    "01/Mar/2010,02/Mar/2010<br/>03/Mar/2010,04/Mar/2010<br/>05/Mar/2010"

    Here I want to replace Comma (,) by <br/>

    Note:

    I want to replace even commas only. (before 03/mar/2010 & 05/Mar/2010..like)
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    This will work


    Code:
    SELECT REPLACE(yourstring_column,',','<br/>') from Sometable

    Comment

    • visweswaran2830
      New Member
      • Nov 2009
      • 92

      #3
      I dont want to replace all of my commas, I just want to replace alternate commas only.How can I acheive

      Comment

      • ThatThatGuy
        Recognized Expert Contributor
        • Jul 2009
        • 453

        #4
        Originally posted by visweswaran2830
        I dont want to replace all of my commas, I just want to replace alternate commas only.How can I acheive
        Then you might need to use a different separator other than comma(,)... probably a hyphen(-)

        Comment

        Working...