Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric
\
breaks a long string constant, character or binary, 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 new line after the backslash must either be a line feed character (U+000A) or a combination of carriage return (U+000D) and line feed (U+000A) in that order.
The following example uses a backslash and a carriage return to split a character string into two lines.
SELECT 'abc\
def' AS [ColumnResult];
Here's the result set.
ColumnResult
------------
abcdef
The following example uses a backslash and a carriage return to split a binary string into two lines.
SELECT 0xabc\
def AS [ColumnResult];
Here's the result set.
ColumnResult
------------
0xABCDEF
Data Types (Transact-SQL)
Built-in Functions (Transact-SQL)
Operators (Transact-SQL)
(Division) (Transact-SQL)
(Division Assignment) (Transact-SQL)
Compound Operators (Transact-SQL)
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today