Home  >  Article  >  Database  >  替换字段中有回车/换行的SQL

替换字段中有回车/换行的SQL

WBOY
WBOYOriginal
2016-06-07 14:54:531542browse

取消或替换回车/换行,保持数据清洁 无 --替换回车UPDATE table_nameSET field_name=REPLACE(field_name,CHR(13),'')WHERE INSTR(field_name,CHR(13))0 --替换换行UPDATE table_nameSET field_name=REPLACE(field_name,CHR(10),'')WHERE INSTR(field_name,CHR(

取消或替换回车/换行,保持数据清洁
--替换回车
UPDATE table_name
SET field_name=REPLACE(field_name,CHR(13),'')
WHERE INSTR(field_name,CHR(13))>0 
--替换换行
UPDATE table_name
SET field_name=REPLACE(field_name,CHR(10),'')
WHERE INSTR(field_name,CHR(10))>0 

table_name:表名
field_name:列名
Statement:
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