This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Check the below input data and expected output to Mask the Credit Card Number.
Sample Credit Card Number:
1 |
8168888888521458 |
Expected Output:
1 2 3 |
Result -------------------- XXXXXXXXXXXX1458 |
Solution:
1 2 3 4 5 |
DECLARE @CreditCardNo VARCHAR(20) SET @CreditCardNo = '8168888888521458' SELECT STUFF(@CreditCardNo, 1, LEN(@CreditCardNo) - 4, REPLICATE('X', LEN(@CreditCardNo) - 4)) AS Result |
Please try the different solution for this puzzle and share it via comment...