Decode-SqlName

SYNOPSIS

Decodes an encoded SQL Server identifier name.

SYNTAX

DESCRIPTION

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 |

EXAMPLES

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.

PARAMETERS

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

String

OUTPUTS

String

NOTES

Encode-SqlName