Solved

line break - mysql

Posted on 2009-03-29
4
1,519 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 250 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

690 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