replace set of integers with respective string values

Posted by Tripz on Server Fault See other posts from Server Fault or by Tripz
Published on 2012-06-05T20:15:48Z Indexed on 2012/06/05 22:42 UTC
Read the original article Hit count: 261

I have a query which return the output like -- 5,4,6

Where 1 = apple, 2 = mango, 3 = banana, 4 = plum, 5 = cherry, 6 = kiwi etc.

I would like to update my output as cherry,plum,kiwi instead of 5,4,6 How can I achieve that in the same select statment.

I am okay to hard code the values.

Please confirm

May be I did explain clearly

Here is the sample

SELECT fruits FROM t_fruitid where id = 7

is returning me '5,6,4' as a single row

Now I want to update this single row output as 'cherry,plum,kiwi'

How do I do this

Thanku

© Server Fault or respective owner

Related posts about sql-server-2008

Related posts about sql-server-2005