Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    153

    Unanswered: Repalce the column value

    Hi All,

    I Would like to fetch the value of a column like below:

    Table : Person
    Column : Srno
    Status (this field has a pair value like (30#Y), multi pairs are seperated by ',' and could have N number of pairs.

    Column Value :

    Srno Status
    1 30#Y,20#N
    2 10#N
    3 10#Y,20#Y,30#N

    I would like to fetch the status value like below :

    Status
    30 (Yes), 20 (No)
    10 (No)
    10 (Yes), 20 (Yes), 30 (No)

    It would be nice if any one can help on this.


    Thanks with Regards,
    JD

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    The first thing you should do is fix your broken design.

    If you can't do that, something like this might work:
    Code:
    SELECT srno, 
           replace(replace(status, '#Y', ' (Yes)'), '#N', ' (No)'))
    FROM your_table

  3. #3
    Join Date
    Jan 2004
    Posts
    153
    Thanks Shammat for your reply. It is working fine.


    Thanks with Regards,
    JD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •