Data Mask SQL

 
 

Transform.DateTimeVariance

Sample SQL...

/*===================================================================================
 Mask Type: Transform.DateTimeVariance =====================================================================================*/
/*---------------------------------------------------------------------
Table: [dbo].[DimEmployee]
Column: [HireDate]
Mask:
* Type: 'Transform: DateTimeVariance...'
* Params: '5|240'
* Category: 'Transform' - Overwrite all rows with an "obsfucated" original value
* Descrip: This mask transforms each row by randomly adjusting the date value up or
           down by the number of days specified in parameter. It also has a second
           parameter for the number of minutes to randomly adjust the time up or
           down by.
---------------------------------------------------------------------*/
UPDATE [dbo].[DimEmployee]
SET [HireDate]
  = DATEADD(DAY
            , ((CAST(ABS(CHECKSUM(NEWID())) AS FLOAT) / 2147483648) * 5 * 2 - 5)
            , [HireDate])
  + ((CAST(ABS(CHECKSUM(NEWID())) AS FLOAT) / 2147483648)
    * (240 / 1440.0)
    * 2 - (240 / 1440.0));

 

eXTReMe Tracker