Can some one help ith this

I have a table with  columns
when I do a select * out put ill be like this
id msg
1 la\ca\us
2 lon\lon\uk

Is it possible to have output like this .Basically there should be only 2 rows but where there is a '\'  it should show up below
1 la
   ca
   us
2 lon
   lon
   uk

Can some one help
vijay11Asked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
vijay11,

You could run a query like this:

SELECT id, REPLACE(msg, '\', CHAR(13) + CHAR(10)) AS msg
FROM SomeTable

Open in new window


If your presentation layer supports line breaks and text wrapping, that would produce the output you seek.

Depending on your presentation layer, you might need to replace only with CHAR(13) or only with CHAR(10).

Patrick
0
 
TheAmeobaCommented:
I don't know of a way to do that with the SQL command, but once you have the values you should be able to use a simple string replace command to replace the / with the new line character before outputting it or using it in your program.

What language are you developing in?
0
 
vijay11Author Commented:
How can I update this column in the table
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.