I want to mask some SQL data by #######
.
I am trying following SQL:
SELECT
CONCAT ( SUBSTRING(email_address,1,3),
'#####' ,
SUBSTRING(email_address,LENGTH(email_address) - 2, LENGTH(email_address) )
) AS Result, REPLACE( SUBSTRING(email_address,1,3, ' ', ' ' ) as Replaced
FROM employees
email_address
column in table are already encrypted or hashed. I want to mask data dynamically ( according to length ) I want to show only 5 character as it is in the middle and remaining all in '#########' format. Length should not be changed after masking.
Data existing in table like:
15a97dbe57dc993847fbf18394948b8b
1so8GhueT58ked3OvsMeqHbQfIN+zyg8gGj6sQrUB6A=