开发者

regex in mysql update statement, convert to lowercase

开发者 https://www.devze.com 2023-01-31 23:18 出处:网络
i\'d like to update a table field in my mysql data base and convert all links to lowercase, e.g. to convert:

i'd like to update a table field in my mysql data base and convert all links to lowercase, e.g.

to convert:

http://www.domamain.com/MyLinks/News/FileName.html
to
http://www.domamain.com/mylinks/news开发者_如何学编程;/filename.html

Can this be done?

Thanks


You can convert an entire column to lowercase with the LOWER() function

UPDATE mytable
SET url = LOWER(url)

It seems that you can't do regular expression replace in MYSQL though: How to do a regular expression replace in MySQL?

0

精彩评论

暂无评论...
验证码 换一张
取 消