Masked Dynamic Data

Copper Contributor

Hello,

 

I have got one question.

 

I want to use Dynamic data masking method for INT type column. I found that I can use the default() function.

for example:

 

 

/*MS Sql Server*/

 

CREATE TABLE [dbo].[Test](

[Id] [int] IDENTITY(1,1) NOT NULL,

[Payment] [money] MASKED WITH (FUNCTION = 'default()') NOT NULL

)

 

Unfortunately I need you. Instead of the default() function, I want to insert a function written by me, where I will have a logic written to only hide payments where Payment > 1000.00.

 

If you understand my question correctly, please share your opinion or even give me a sample of the script. How can I use the function I wrote and also put the above mentioned logic.

 

thanks

3 Replies

@Beka_Tsaava , that's not possible to use a user defined function for masking. See column_definition (Transact-SQL) - SQL Server | Microsoft Learn,  => MASKED, you can use only the 4 predefined functions.

@olafhelper  aha Okey. thank you very much

Hi Beka,

To get more information on dynamic data masking in SQL Server, refer below website. The website is having in-depth information.

https://madesimplemssql.com/dynamic-data-masking/