如何找到子字符串并替换它? [英] How to find sub-string and replace it?
本文介绍了如何找到子字符串并替换它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下几行:
Name Url
name1 http://foo.com/this/that
name6 http://that.net/hello
name2 http://foo.com/hello/world
name3 http://foo.com/world/hello
name4 http://hello.com/this/that
我需要编写一个查询,将每个 foo.com
更改为 hello.com
.
I need to write a query that will change every foo.com
to hello.com
.
有什么想法吗?
推荐答案
看看 REPLACE() 函数:http://msdn.microsoft.com/en-us/library/ms186862.aspx.您应该能够在 UPDATE 语句中使用它来实现所需的结果.
Take a look at the REPLACE() function: http://msdn.microsoft.com/en-us/library/ms186862.aspx. You should be able to use that in an UPDATE statement to achieve the desired result.
这篇关于如何找到子字符串并替换它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文