两个表sheet1和sheet2
sheet1内由于各种原因,字符串损坏了,个别字符变成“问号”了,sheet2内是完好的,可不可以将sheet2内完好的字符串给sheet1 进行替换。
sheet1:
name
abcd?
a?ee
?eecd
123?4
11222?d
sheet2:
name
scll
ADc
abcde
abee
1h3h
aeecd
123d4
11222ed
------解决方案--------------------
select patindex('%a_B%' ,'adadfacb')
go
use tempdb
go
create table temp2
(
name nvarchar(100)
)
create table temp1
(
name nvarchar(100)
)
go
insert into temp1([name])
select
'name'
union select
'abcd?'
union select
'a?ee'
union select
'?eecd'
union select
'123?4'
union select
'11222?d'
go
insert into temp2([name])
select
'name'
union select
'scll'
union select
'ADc'
union select
'abcde'
union select
'abee'
union select
'1h3h'
union select
'aeecd'
union select
'123d4'
union select
'11222ed'
go
select * from temp1 a inner join temp2 b on PATINDEX('%'+Replace(a.name,'?','_')+'%',b.name)>0