Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 replace

Author  Topic 

vipinjha
Starting Member

21 Posts

Posted - 2012-01-30 : 05:16:45
Dear Sir ,
I want replace first 4 digit cellnumber with ****

suppose the cell is 9845123695
then it should be look like ****123695

i need sql logic

Thankz & regards,
Vipin jha


Vipin jha

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2012-01-30 : 05:26:12
select case when len(CellNumber) > 4 then '****' + RIGHT(Cellnumber, len(Cellnumber) - 4) else '****' end
from Table


Duane.
Go to Top of Page

vipinjha
Starting Member

21 Posts

Posted - 2012-01-30 : 05:30:28
thans sir

Vipin jha
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-30 : 11:46:38
this will cover all

select stuff(CellNumber,1,4,'****')
from Table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -