Remove/x0a (line break) from the SQL statement of sybase)

Source: Internet
Author: User
Tags sybase database
When we use the sybase database, we often use excel to read the content in excel and insert it into the sybase Database Table. During this process, ex

When we use the sybase database, we often use excel to read the content in excel and insert it into the sybase Database Table. During this process, ex

Abstract: when using the sybase database, we often use excel to read the content in excel and insert it into the sybase database table, in this process, there are often line breaks in excel (line breaks are not visible). After being imported to a table, there are often different errors caused by line breaks. So how can I quickly remove/x0a directly? First, how to collect/x0a, and then remove/x0a.

1. The cable has a/x0a or/X0A field.

Select * from xxxx where userid like '%

% '(A linefeed is included here)

2. Remove/x0a or/X0A

Assume that the data with id 12595 has a line break. The SQL statement is as follows:

Update xxxx set userid = (
Select str_replace (userid ,'
', Null) from xxxx where userid like' %
% 'And id = 12595
) Where id = 12595.

Idea: first query the value of the 12595 pair that should be userid, then use the str_replace function to replace the line break, and then update the data through update.

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.