SQL中的更新替换分号获取语法错误 [英] Update replace semicolon in SQL gets syntax error

查看:284
本文介绍了SQL中的更新替换分号获取语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将SQL文件导入到数据库中,但是出了点问题.句子/短语末尾的所有标点符号都有多余的空格.

I import an SQL file to my database but there is something wrong. All punctuation at the end of a sentence/phrase have extra space.

示例:

This is a sentence .
This , as you can see , is a problem .
Do it !

应为:

This is a sentence.
This, as you can see, is a problem.
Do it!

要纠正,我计划在这种情况下在phpMyAdmin上运行SQL命令

To correct, I am planning to run SQL commands on phpMyAdmin in this context

UPDATE book SET content = REPLACE(content,' .','.');
UPDATE book SET content = REPLACE(content,' ,',',');
UPDATE book SET content = REPLACE(content,' ?','?');
UPDATE book SET content = REPLACE(content,' !','!');
UPDATE book SET content = REPLACE(content,' :',':');

到目前为止,一切都很好.但是当我在这样的分号上尝试过

So far so good. But When I tried it on a semicolon like this

UPDATE book SET content = REPLACE(content,' ;',';');

模拟查询时出现语法错误#1064.

I get syntax error #1064 when I simulate the query.

我试图用这样的反斜杠转义,但存在相同的错误

I tried escaping it with a backslash like this but same error

UPDATE book SET content = REPLACE(content,' \;','\;');

有什么办法解决这个问题吗?

Any idea how to resolve this?

谢谢

推荐答案

尝试

delimiter /
UPDATE book SET content = REPLACE(content,' ;',';');
delimiter ;

这是phpMyAdmin中的一个字段,默认情况下设置为分号.设置为/.

It was a field in phpMyAdmin which is set to semicolon by default. Set on /.

这篇关于SQL中的更新替换分号获取语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆