Solved

line break - mysql

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mysql ide 10 39
UPDATE query not working in mysqli php 8 49
AWS EC2 & RDS Instance 5 34
mysql date time 14 28
Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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