Replace a newline character in a SQL field, carriage return

Source: Internet
Author: User

Sometimes we need to replace some unwanted SQL fields, and here are a few things you can do to replace SQL fields, if you're interested in replacing SQL fields.

Replace the line break in the SQL field with a carriage return:

1> Carriage return character

SELECT *, replace (detail, CHAR (+), ' <br> ') as displays the replaced content from Loginfo

2> line break

SELECT *, replace (detail, CHAR (Ten), ' <br> ') as displays the replaced content from Loginfo

3> Return line break

SELECT *, replace (detail, char (+) + char (Ten), ' <br> ') as displays the replaced content from Loginfo

4> Replace carriage return line break to <BR><BR>

UPDATE Loginfo
SET detail = REPLACE (detail, char) + char (Ten), ' <br><br> ')

Note In the DOS \win series there will be a carriage return + newline character CHAR (10) +char

In UNIX \ Linux is a line break

Convert just remove the carriage return char (13).

The following SQL statement

UPDATE loginfo SET detail = REPLACE (detail, CHAR (13), ")

Replace a newline character in a SQL field, carriage return

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.