The Decode-SqlName cmdlet decodes an encoded SQL Server identifier.
SQL Server delimited identifiers can contain special characters that are not normally supported in PowerShell object names.
These extended characters must be either encoded to their hexadecimal representation or escaped using the ` character.
Certain characters cannot be escaped.
The hexadecimal encoding is in the format %nn.
This cmdlet converts the following encodings to the corresponding characters:
- %5C becomes \
- %3A becomes :
- %2E becomes .
- %2F becomes /
- %25 becomes %
- %3C becomes <
- %3E becomes >
- %2A becomes *
- %3F becomes ?
- %5B becomes [
- %5D becomes ]
- %7C becomes |
Example 1: Decode a SQL Server identifier that is encoded in a hexadecimal representation
PS C:\> Decode-SqlName -SqlName "My%3ATable`/" My:Table/
This command decodes a SQL Server identifier that has been encoded in hexadecimal representation for the ':' character. PowerShell also removes the escaping back-tick character (`) from an escaped '/' character.