I am trying to mask a certain string such that only its last 4 characters are visible and rest are masked.
I have tried the below code in SQL server.
select REPLACE(trans_no,substring(trans_no,1,len(trans_no)-4),'*') from uvi_generalledgerwf where trans_no = '11043770'
Actual Result - *3770
Whereas, my expected outcome should be ****3770
This transaction number's length may vary but the last 4 digits from right should always be visible.