| 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. |
| ms.prod | sql |
| ms.technology | sql-server-powershell |
| ms.topic | conceptual |
| ms.assetid | 8a73e945-daa6-4e5d-93da-10f000f1f3a2 |
| author | markingmyname |
| ms.author | maghan |
| ms.reviewer | matteot, drskwier |
| ms.custom | |
| ms.date | 10/14/2020 |
[!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