Split into 2 lines

I have this SQL Data texts:

"Approved By: John Doe @ 6/1/2011 10:37:41 AM " 

and I want to split into 2 lines

"Approved By:
                     

               John Doe @ 6/1/2011 10:37:41 AM"



Thanks!
JaimeJegoniaAsked:
Who is Participating?
 
santhimurthydCommented:
Do you want this to be in Two rows else while displaying in Browser this needs to be in two lines

Two line while displying in IE Browser
select replace('Approved By: John Doe @ 6/1/2011 10:37:41 AM' , 'By:' , 'By:<br/>')

Two different rows

select substring('Approved By: John Doe @ 6/1/2011 10:37:41 AM' , 0 , charIndex('By:' , 'Approved By: John Doe @ 6/1/2011 10:37:41 AM') + 3)
Union ALL
select substring('Approved By: John Doe @ 6/1/2011 10:37:41 AM' ,charIndex('By:' , 'Approved By: John Doe @ 6/1/2011 10:37:41 AM') + 3
, len('Approved By: John Doe @ 6/1/2011 10:37:41 AM')-(charIndex('By:' , 'Approved By: John Doe @ 6/1/2011 10:37:41 AM') + 3))

0
 
keyuCommented:
Try this

SELECT REPLACE('Approved By: John Doe @ 6/1/2011 10:37:41 AM ','By:','By:'+char(13));
0
 
JaimeJegoniaAuthor Commented:
I'm not sure how to use your suggestions:

You need to take note that my sample data is to be taken from SQL DB field name "dbo.PO.Approval" with "Approved By:" appears to be constant, and the rests are dynamic.

Thanks.


0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
keyuCommented:
select Replace(Fieldname,'By:','By:'+char(13)) from tablename

here fieldname is your fieldname  and tablename is your tablename
 
0
 
JaimeJegoniaAuthor Commented:
keyu,

I tried your suggestions but did not work.


 Thanks for the try.
0
 
JaimeJegoniaAuthor Commented:
I preferred you 1st suggestion.

Thanks!
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.