Escape SQL Server Identifiers
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
You can often use the back-tick escape character (`) to escape characters that are allowed in SQL Server 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.
Note
There are two SQL Server PowerShell modules; SqlServer and SQLPS.
The SqlServer module is the current PowerShell module to use.
The SQLPS module is included with the SQL Server installation (for backward compatibility) but is no longer updated.
The SqlServer module contains updated versions of the cmdlets in SQLPS and includes new cmdlets to support the latest SQL features.
Install the SqlServer module from the PowerShell Gallery.
For more information, see SQL Server PowerShell.
The back-tick character (`) is usually on the key in the upper left of the keyboard, under the ESC key.
Examples
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
See Also
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre