这是一个示例表:
name | picture
John S. | http://servera.host.com/johns.png
Linda B. | http://servera.host.com/lindab.png
...
Run Code Online (Sandbox Code Playgroud)
比方说有几百条记录.
我们还说我们将服务器从"servera"转移到"serverb".
是否可以通过一个查询进入此表,以重命名"picture"列中的内容,以便每条记录读取正确的服务器名称?
Ana*_*y G 103
T-SQL:
update TBL
set picture = Replace(picture, 'servera', 'serverb')
where picture like '%servera%'
Run Code Online (Sandbox Code Playgroud)
Oracle:
update TBL
set picture = replace(picture, 'servera', 'serverb')
where picture like '%servera%'
Run Code Online (Sandbox Code Playgroud)
MySQL:
update TBL
set picture = REPLACE(picture, 'servera', 'serverb')
where picture like '%servera%'
Run Code Online (Sandbox Code Playgroud)
And*_*rew 18
UPDATE users
SET picture = REPLACE(picture, 'http://servera.host.com/', 'http://serverb.host.com/')
WHERE picture LIKE 'http://servera.host.com/%';
Run Code Online (Sandbox Code Playgroud)
我要包含更多字符串,因为我担心'修复'名为'somethingserverasomething.jpg'的图像.我可能还会想到有一个base_url表,只是在用户中存储图像文件名,但这不是你问的问题;-)
归档时间: |
|
查看次数: |
80860 次 |
最近记录: |