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
 General SQL Server Forums
 New to SQL Server Programming
 convert - query help

Author  Topic 

palak
Yak Posting Veteran

55 Posts

Posted - 2008-03-19 : 15:01:42
how can i convert

4332 3423 5423 5428

And convert it to

XXXX XXXX XXXX 5428

palak
Yak Posting Veteran

55 Posts

Posted - 2008-03-19 : 15:07:11
i tried like:

select replace('4332 3423 5423 5428',substring('4332 3423 5423 5428',1,len('4332 3423 5423 5428')-4),'x')

but i m getting:
x5428

instead of XXXX XXXX XXXX 5428


can anyone help me? plz


thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-19 : 16:56:11
SELECT 'XXXX XXXX XXXX ' + RIGHT(CreditCardNumber, 4)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -