Home > Database > Mysql Tutorial > body text

sybase的SQL去掉字段中的/x0a(换行符)

WBOY
Release: 2016-06-07 17:28:19
Original
1202 people have browsed it

我们在使用sybase数据库的时候,经常使用excel通过程序读取excel读取内容然后插入到sybase数据库表中,在这个过程中经常会出现ex

摘要:我们在使用sybase数据库的时候,经常使用excel通过程序读取excel读取内容然后插入到sybase数据库表中,在这个过程中经常会出现excel中存在换行符(看不到换行符),导入到表中后经常会因为换行符导致各种不同的错误,所以怎么快速的将/x0a直接去掉呢?首先怎么收索到包含/x0a,然后去掉/x0a。
 
1、收索存在/x0a或/X0A的字段
 
select * from xxxx  where userid like '%
 
%'(这里包含一个换行符)
 
2、将/x0a或/X0A去除
 
假设id为12595的数据存在换行符,sql如下:
 
update xxxx set userid=(
 select str_replace(userid,'
 ',null)  from xxxx where userid like '%
 %' and id=12595
 ) where id=12595
 
思路:先查询出12595对应当userid的值,然后通过str_replace函数将换行符替换掉,,最后通过update更新这条数据。

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!