United Kingdom National Insurance Number masking

You can use the TRANS NID function to mask United Kingdom National Insurance Numbers (NINO).

A NINO consists of three parts: two letters (the prefix), six digits (the number), and one optional letter (the suffix).

Output formats (FMT=)

The following output formats are available for a NINO.

A NINO can be masked without a separator or with a separator in either a three- or five-part format.

C indicates values that are copied. X indicates values that are masked. For example, 3C4X indicates that the first three characters are copied and the next four characters are masked.

To create a NINO without a separator, use the following parameters:
Fields to be masked Format without separator
Prefix, Number UK=8X1C
Number (MTD=mask default) UK=2C6X1C
Prefix, Number, Suffix (MTD=random only) UK=9X

To create a NINO with either a three- or five-part format, use the following parameters:

Fields to be masked Format with dash separator Format with space separator Format with period separator
Prefix, Number (three-part) UK=2X-6X-1C UK=2X 6X 1C UK=2X.6X.1C
Prefix, Number (five-part) UK=2X-2X-2X-2X-1C UK=2X 2X 2X 2X 1C UK=2X.2X.2X.2X.1C
Number (three-part) UK=2C-6X-1C UK=2C 6X 1C UK=2C.6X.1C
Number (five-part) UK=2C-2X-2X-2X-1C UK=2C 2X 2X 2X 1C UK=2C.2X.2X.2X.1C
Prefix, Number, Suffix (three-part) (MTD=random only) UK=2X-6X-1X UK=2X 6X 1X UK=2X.6X.1X
Prefix, Number, Suffix (five-part) (MTD=random only) UK=2X-2X-2X-2X-1X UK=2X 2X 2X 2X 1X UK=2X.2X.2X.2X.1X

Data types

The following data types are permitted for source and destination columns. Restrictions for each data type are noted.

CHAR and NCHAR
The length of the column must be at least 9 characters.
VARCHAR and NVARCHAR
The length of the column must be at least 9 characters.

Validation (VAL=Y)

The VAL=Y parameter is not valid for NINO masking and will be ignored.

Special processing

The following checks will be made during processing:

Skipped rows

A source row will be skipped and not written to the destination table if the following occurs:

Null value
The source value is NULL but the destination column does not allow a NULL value.
Invalid NINO
  • The size of the source value is less or greater than the size of a valid NINO.
  • The source value includes separators in the wrong positions.
  • The source value includes an invalid separator.
  • The source value includes an invalid prefix.
  • The source value includes a suffix other than A, B, C, or D.
  • The source value includes a number field that is not between 000001 and 999999.


Feedback