| title | Escape SQL Server Identifiers |
|---|---|
| description | Some characters that can appear in SQL Server-delimited identifiers aren't supported in Windows PowerShell paths. Learn how some of these can be escaped with the back-tick character. |
| author | markingmyname |
| ms.author | maghan |
| ms.reviewer | matteot, drskwier |
| ms.date | 10/14/2020 |
| ms.service | sql |
| ms.subservice | sql-server-powershell |
| ms.topic | conceptual |
[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]
You can often use the back-tick escape character (`) to escape characters that are allowed in [!INCLUDEssNoVersion] delimited identifiers but not Windows PowerShell path names. Some characters, however, cannot be escaped. For example, you can't escape the colon character (:) in Windows PowerShell. Identifiers with that character must be encoded. Encoding is more reliable than escaping because encoding works for all characters.
[!INCLUDE sql-server-powershell-version]
The back-tick character (`) is usually on the key in the upper left of the keyboard, under the ESC key.
This is an example of escaping a # character:
cd SQLSERVER:\SQL\MyComputer\MyInstance\MyDatabase\MySchema\`#MyTempTable This is an example of escaping the parenthesis when specifying (local) as a computer name:
Set-Location SQLSERVER:\SQL\`(local`)\DEFAULT