Solved

line break - mysql

Posted on 2009-03-29
4
1,506 Views
Last Modified: 2012-05-06
Hi,

I want to add a line break in mySQL inline query..
I am trying to execute

update sample set post_text = replace (post_text,'http:/','¶http:/') where id =64
here ¶ (ascii code 182) represent the end of paragraph.
My aim is to provide a extra  line break infront of 'http:/' tag in DB field. And i dont know how to insert a line break in a query of MYSQL
0
Comment
Question by:badalpatel
  • 2
4 Comments
 
LVL 17

Expert Comment

by:k_murli_krishna
Comment Utility
You can try putting line feed/break/new line &/ carriage return like \n\r OR just \n or \r. Also refer to:
http://www.robelle.com/smugbook/ascii.html

You can get more stuff in google about line feed/break/new line and carriage return. Data from MySQL client or JDBC etc. clients will be displayed as entered/updated but when fed into browser etc. the line breaks will come into effect.
0
 
LVL 6

Author Comment

by:badalpatel
Comment Utility
i have not try ur solution because i want to use the ASCII character only..
Do u know how to update the query with the ascii character.
I know in MSSQL u can use chr(182) function but i dont know such function in MYSQL.

Please help someone
0
 
LVL 17

Accepted Solution

by:
k_murli_krishna earned 250 total points
Comment Utility
We have CHAR() function in MySQL which works similar to CHR in other RDBMS. Please refer:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char

In the same above link, you can combine with usage of ASCII(). Like for ex:
CHAR(65) = 'A'
ASCII(CHAR(65)) = 65
CHAR(ASCII('A')) = 'A'

These are used as escape characters for special characters like '&' etc. in INSERT/UPDATE/DEELTE/SELECT for data. The other escape characters are ', " and \ or \". These other escape characters are used for table/column names with allowed special characters.

Selecting data in MySQL client or third party tools in a SQL way, the line feed/break/new line &/ carriage return may not really come into effect but when applied in Java etc. in appletviewer/application window(thick client), browser (thin client), they do come into effect.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now