ConvertTo-EncodedSqlName

Encodes extended characters in SQL Server names to formats usable in Windows PowerShell paths.

Syntax

ConvertTo-EncodedSqlName [-SqlName] <String> [-InformationAction <ActionPreference>]
 [-InformationVariable <String>] [<CommonParameters>]

Description

The ConvertTo-EncodedSqlName cmdlet encodes special characters in SQL Server names to formats usable in Windows PowerShell paths. SQL Server delimited identifiers can contain characters not normally supported in Windows PowerShell object names. When using delimited identifiers in SQL Server provider paths, 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 for the characters is in the format %nn. The characters encoded by ConvertTo-EncodedSqlName are: \:./%<>*?[]|

Examples

Example 1: Encode a SQL Server table name

PS C:\> ConvertTo-EncodedSqlName -SqlName "My:Table/" "My%3ATable%2F"

This command encodes a SQL Server table name that contains : and / characters.

Parameters

-SqlName

Specifies the SQL Server identifier to be encoded.

Type:String
Required:True
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Type:ActionPreference
Aliases:infa
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

String