Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

\ (Backslash) (Transact-SQL)

Breaks a long string constant into two or more lines for readability.

Topic link iconTransact-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 Transact-SQL statement. It is a command that is recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code Editor.

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

SELECT 'abc\
def' AS ColumnResult;

Here is the result set.

ColumnResult

------------

abcdef

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.