ConvertFrom-EncodedSqlName

Returns the original SQL Server identifier when given an identifier that has been encoded into a format usable in Windows PowerShell paths.

Syntax

ConvertFrom-EncodedSqlName
                [-SqlName] <String>
                [<CommonParameters>]

Description

The ConvertFrom-EncodedSqlName cmdlet returns the un-encoded SQL Server identifier when given an identifier that has been encoded into a format usable in Windows PowerShell paths.

SQL Server delimited identifiers can contain special characters not normally supported in Windows PowerShell object names.

These extended characters must be either encoded to their hexadecimal representation or escaped using the ` character.

Certain characters, such as the colon character (:) cannot be escaped.

The hexadecimal encoding is in the format %nn.

Decode-SqlName 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

PS C:\> ConvertFrom-EncodedSqlName -SqlName "My%3ATable`/"

My:Table/

This command decodes a SQL Server identifier that has an encoded hexadecimal representation for the : character. Windows PowerShell also removes the escaping back-tick character (`) from an escaped / character.

Parameters

-SqlName

Specifies the SQL Server identifier that this cmdlet reformats.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Outputs

String