?
Solved

line break - mysql

Posted on 2009-03-29
4
Medium Priority
?
1,523 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 17

Expert Comment

by:k_murli_krishna
ID: 24012410
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
ID: 24015988
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 1000 total points
ID: 24025872
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 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