日期:2014-05-17 浏览次数:20617 次
UPDATE TEST
SET Contents= 'http://168.174.5.222:1234/zip/xx'
WHERE Contents like 'http://www.sss.cn/Port/ftp/myapp/%.%.%.%'
--楼主的表述不清楚,我估计就这两种可能:
--1.全部更新
--> 测试数据:@T
declare @T table([id] int,[contents] varchar(46))
insert @T
select 1,'http://www.sss.cn/Port/ftp/myapp/192.168.0.1' union all
select 2,'http://www.sss.cn/Port/ftp/myapp/192.168.0.2' union all
select 3,'http://www.sss.cn/Port/ftp/myapp/201.168.0.3' union all
select 4,'http://www.sss.cn/Port/ftp/myapp/235.168.0.4' union all
select 5,'http://www.sss.cn/Port/ftp/myapp/192.168.0.43' union all
select 6,'http://www.sss.cn/Port/ftp/myapp/192.168.0.3' union all
select 7,'http://www.sss.cn/Port/ftp/myapp/192.168.0.1' union all
select 8,'http://www.sss.cn/Port/ftp/myapp/192.168.0.455'
update @T set contents='http://168.174.5.222:1234/zip/xx'
select * from @T
/*
id contents
----------- ----------------------------------------------
1 http://168.174.5.222:1234/zip/xx
2 http://168.174.5.222:1234/zip/xx
3 http://168.174.5.222:1234/zip/xx
4 http://168.174.5.222:1234/zip/xx
5 http://168.174.5.222:1234/zip/xx
6 http://168.174.5.222:1234/zip/xx
7 http://168.174.5.222:1234/zip/xx
8 http://168.174.5.222:1234/zip/xx
*/
--2.更新除地址以外的内容
declare @T1 table([id] int,[contents] varchar(46))
insert @T1
select 1,'http://www.sss.cn/Port/ftp/myapp/192.168.0.1' union all
select 2,'http://www.sss.cn/Port/ftp/myapp/192.168.0.2' union all
select 3,'http://www.sss.cn/Port/ftp/myapp/201.168.0.3' union all
select 4,'http://www.sss.cn/Port/ftp/myapp/235.168.0.4' union all
select 5,'http://www.sss.cn/Port/ftp/myapp/192.168.0.43' union all
select 6,'http://www.sss.cn/Port/ftp/myapp/192.168.0.3' union all
select 7,'ht