Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1528
  • Last Modified:

line break - mysql

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
badalpatel
Asked:
badalpatel
  • 2
1 Solution
 
k_murli_krishnaCommented:
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
 
badalpatelAuthor Commented:
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
 
k_murli_krishnaCommented:
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now