SoftadminUtil.PersonalIdentityNumber_Normalize

Type: Scalar function

This function normalizes the format of a Swedish personal identity number (personnummer), or co-ordination number (samordningsnummer) to 12 digits (yyyymmddNNNN), and checks the validity.

Return value: varchar(12)

Returns a normalized social security number if it is valid, otherwise null.

Parameters

@SSN mandatory varchar(8000)
The personal identity number to normalize and validate.

Supported input formats:
yymmddNNNK
yymmdd-NNNK
yymmdd+NNNK
YYyymmddNNNK

Any additional spaces or separators (- or +) will be removed.

When two digits are specified for the year, it is assumed that the person is less than 100 years old, unless the + separator is used between the date of birth and individual numbers.