| title | (Backslash) (Transact-SQL) | Microsoft Docs | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | |||||||||||||
| ms.date | 07/27/2017 | ||||||||||||
| ms.prod | sql-non-specified | ||||||||||||
| ms.reviewer | |||||||||||||
| ms.suite | |||||||||||||
| ms.technology |
|
||||||||||||
| ms.tgt_pltfrm | |||||||||||||
| ms.topic | language-reference | ||||||||||||
| applies_to |
|
||||||||||||
| f1_keywords |
|
||||||||||||
| dev_langs |
|
||||||||||||
| helpviewer_keywords |
|
||||||||||||
| ms.assetid | c97fbb20-3d12-4d0b-9b52-62a229bc83c0 | ||||||||||||
| caps.latest.revision | 22 | ||||||||||||
| author | BYHAM | ||||||||||||
| ms.author | rickbyh | ||||||||||||
| manager | jhubbard |
[!INCLUDEtsql-appliesto-ss2008-asdb-xxxx-xxx_md]
[!INCLUDEssNoVersion] provides commands that are not [!INCLUDEtsql] statements, but are recognized by the sqlcmd and osql utilities and [!INCLUDEssManStudioFull] Code Editor. These commands can be used to facilitate the readability and execution of batches and scripts.
\ breaks a long string constant into two or more lines for readability.
Transact-SQL Syntax Conventions
<first section of string> \
<continued section of string>
<first section of string>
Is the start of a string.
<continued section of string>
Is the continuation of a string.
This command returns the first and continued sections of the string as one string, without the backslash.
The backslash is not a [!INCLUDEtsql] statement. It is a command that is recognized by the sqlcmd and osql utilities and [!INCLUDEssManStudioFull] Code Editor.
The following example uses a backslash and a carriage return to split the string into two lines.
SELECT 'abc\
def' AS ColumnResult;
[!INCLUDEssResult]
ColumnResult
------------
abcdef
Data Types (Transact-SQL)
Built-in Functions (Transact-SQL)
Operators (Transact-SQL)
(Divide) (Transact-SQL)
(Divide EQUALS) (Transact-SQL)
Compound Operators (Transact-SQL)