powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Encode-SqlName



NAME
Encode-SqlName

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

SYNTAX
Encode-SqlName [-SqlName] []


DESCRIPTION
Encodes special characters in SQL Server names to formats usable in PowerShell paths. SQL Server delimited identifi
ers can contain characters not normally supported in PowerShell object names. When using delimited identifiers in S
QL Server provider paths, these extended characters must be either encoded to their hexadecimal representation or e
scaped using the ` character. Certain characters, such as the colon character (:) cannot be escaped. The hexadecima
l encoding for the characters is in the format %nn. The characters encoded by Encode-SqlName are: \:/%<>*?[]|


PARAMETERS
-SqlName
The SQL Server identifier to be encoded.

Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS
String


OUTPUTS
String


NOTES




-------------- Example 1 --------------

C:\PS>Encode-SqlName -SqlName "My:Table/"


Encodes a SQL Server table name that contains : and / characters.


My%3ATable%2F



RELATED LINKS
SQL Server Books Online: Using SQL Server Identifiers in PowerShell
SQLServer Provider