4

In SQL Server 2016 or SQL Azure, there is a feature called Dynamic Data Masking. However, it only has 4 types of masks. Is it possible to create custom mask functions? And how can I do this? I want a mask function like below(replace alphabet character with *):

String in database:

How do you do?

After masking:

*** ** *** **?
L.W
  • 175
  • 1
  • 10

1 Answers1

0

I think you should use the Custom String function

Something like this should do the trick

Alter Table[YourSchema].[YourTableName] Alter Column YourColumn Add masked with (function='Partial(0,"*",0)')

I didn't have time to test it so is a bit of a "blind clue"

You can check this article: https://www.sqlservercentral.com/articles/dynamic-data-masking-feature-in-sql-server-2016

I think it will be useful