Backslash (Line Continuation) (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![yes](media/yes.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

\ breaks a long string constant, character or binary, into two or more lines for readability.

Topic link icon Transact-SQL Syntax Conventions

Syntax

<first section of string> \  
<continued section of string>  

Arguments

<first section of string>
Is the start of a string.

<continued section of string>
Is the continuation of a string.

Remarks

This command returns the first and continued sections of the string as one string, without the backslash.

Examples

A. Splitting a character string

The following example uses a backslash and a carriage return to split a character string into two lines.

SELECT 'abc\  
def' AS [ColumnResult];  
  

Here is the result set.

ColumnResult  
------------  
abcdef

B. Splitting a binary string

The following example uses a backslash and a carriage return to split a binary string into two lines.

SELECT 0xabc\  
def AS [ColumnResult];  
  

Here is the result set.

ColumnResult  
------------  
0xABCDEF

See Also

Data Types (Transact-SQL)
Built-in Functions (Transact-SQL)
Operators (Transact-SQL)
(Division) (Transact-SQL)
(Division Assignment) (Transact-SQL)
Compound Operators (Transact-SQL)