select '广东' as name into #t union all select '湖北' as name update a set placeName=name from a,#t t where charindex(t.name,a.placeName)>0drop table #t
update a set placeName= b.placename from a,#tmp b where charindex(b.placename,placeName)>0
update a set placeName= b.关键字 from 表a a,临时表 b where charindex(b.关键字,a.placeName)>0
select '广东' as name into #t union all select '湖北' as namedeclare @t table(id int,placeName varchar(20)) insert into @t select 1,'深圳南山' union all select 2,'广东深圳' union all select 3,'湖北宜昌' union all select 4,'湖北黄风' union all select 5,'广东广州' update a set placeName=t.name from @t a,#t t where charindex(t.name,a.placeName)>0 select placeName from @t drop table #t
update a set placeName=Left(ltrim(placeName),2) where ltrim(placeName) Like'广东%' or ltrim(placeName) Like'湖北%'
into #t
union all
select '湖北' as name
update a
set placeName=name
from a,#t t
where charindex(t.name,a.placeName)>0drop table #t
set placeName= b.placename
from a,#tmp b
where charindex(b.placename,placeName)>0
set
placeName= b.关键字
from
表a a,临时表 b
where
charindex(b.关键字,a.placeName)>0
into #t
union all
select '湖北' as namedeclare @t table(id int,placeName varchar(20))
insert into @t
select 1,'深圳南山' union all
select 2,'广东深圳' union all
select 3,'湖北宜昌' union all
select 4,'湖北黄风' union all
select 5,'广东广州' update a
set placeName=t.name
from @t a,#t t
where
charindex(t.name,a.placeName)>0
select placeName from @t
drop table #t