\ (Backslash) (Transact-SQL)
SQL Server 2008 Books Online (October 2009)
\ (Backslash) (Transact-SQL)

New: 31 October 2008

Breaks a long string constant 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.

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.

Examples

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

See Also

Reference

Data Types (Transact-SQL)
Functions (Transact-SQL)
Operators (Transact-SQL)
/ (Divide) (Transact-SQL)
/= (Divide EQUALS) (Transact-SQL)
Compound Operators (Transact-SQL)

Help and Information

Getting SQL Server 2008 Assistance
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View