SoftadminUtil.OrganisationNumber_Normalize

Type: Scalar function

This function normalizes the format of a Swedish organisation number (organisationsnummer) to 12 digits (XXGNNNNNNNNK), and checks the validity.

Note that all valid social security numbers are also valid organisation numbers. This is because companies of type "enskild firma" uses the owners social security number as organisation number. If not "enskild firma" the XX in the 12 digit format must be "16".

Return value: varchar(12)

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

Parameters

@OrganisationNumber mandatory varchar(1000)
The swedish organisation number to normalize and validate.

Supported input formats:
GNNNNNNNNK
GNNNNN-NNNK
XXGNNNNNNNNK

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