当前位置: 代码迷 >> Sql Server >> 高手指教,Sql语句怎么让email部分带有星号
  详细解决方案

高手指教,Sql语句怎么让email部分带有星号

热度:31   发布时间:2016-04-27 14:46:04.0
高手指教,Sql语句如何让email部分带有星号
select uEmail from table

[email protected]
[email protected]
[email protected]


如何让显示的Email带有星号


[email protected]
[email protected]
[email protected]

谢谢了

------解决方案--------------------
SQL code
select uEmail=replace(uEmail,substring(uEmail,5,3),'***') from table
------解决方案--------------------
SQL code
DECLARE @T TABLE (uEmail NVARCHAR(50))INSERT @T SELECT [email protected]'INSERT @T SELECT [email protected]'INSERT @T SELECT [email protected]'SELECT CASE WHEN  CHARINDEX('@',uEmail)<5 THEN LEFT(uEmail,CHARINDEX('@',uEmail)-1) ELSE LEFT(uEmail,4) end+'***'+RIGHT(uEmail,CHARINDEX('@',REVERSE(uEmail))) AS uEmailFROM @T/*[email protected][email protected][email protected]*/
------解决方案--------------------
探讨

引用:

SQL code
DECLARE @T TABLE (uEmail NVARCHAR(50))
INSERT @T SELECT [email protected]'
INSERT @T SELECT [email protected]'
INSERT @T SELECT [email protected]'


SELECT
LEFT……

------解决方案--------------------
探讨

引用:

SQL code
DECLARE @T TABLE (uEmail NVARCHAR(50))
INSERT @T SELECT [email protected]'
INSERT @T SELECT [email protected]'
INSERT @T SELECT [email protected]'


SELECT
LEFT……
  相关解决方案