日期:2014-05-17 浏览次数:20483 次
insert into 你要保存的表(name1 emial em pass) select name1, email, reverse(substring(reverse(email),1,charindex('@',reverse(email)))) em, replace(replace([str],name1+' ',''),' '+email,'') pass from ( select substring([str],0,charindex(' ',[str])) name1, reverse(substring(reverse([str]),0,charindex(' ',reverse([str])))) email,[str] from systembak.dbo.tianya3 )t
------解决方案--------------------
--try ;WITH cte AS ( select name1, email, reverse(substring(reverse(email),1,charindex('@',reverse(email)))) em, replace(replace([str],name1+' ',''),' '+email,'') pass from ( select substring([str],0,charindex(' ',[str])) name1, reverse(substring(reverse([str]),0,charindex(' ',reverse([str])))) email,[str] from systembak.dbo.tianya3 )t ) UPDATE cte SET name1=name1, emial=emial, em =em,pass=pass
------解决方案--------------------
insert into #test(name1 ,emial, em, pass)--#test要先创建 select name1, email, reverse(substring(reverse(email),1,charindex('@',reverse(email)))) em, replace(replace([str],name1+' ',''),' '+email,'') pass from ( select substring([str],0,charindex(' ',[str])) name1, reverse(substring(reverse([str]),0,charindex(' ',reverse([str])))) email,[str] from systembak.dbo.tianya3 )t