Need help with \\n

What does '\\n' mean in this reference?  I am assuming linefeed but I need to be sure.  This is in a SQL query.

REPLACE(CAST(addrlines AS nvarchar(2000)), CHAR(13), '\\n')

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
This code is replacing the carriage-return character (CHAR(13)) with a literal newline representation I assume for interpretation by whatever is consuming the address.  Typically a combination of CHAR(10) and CHAR(13) is used to represent CRLF (carriage-return / linefeed)
huerita37Author Commented:
I have only seen \n not \\n.

Does the extra \ mean anything?
Brian CroweDatabase AdministratorCommented:
The first one acts as an escape character so that it doesn't treat "\n" as a new line.  Kind of like doubling up on single-quotes to get one single-quote to show up.

It is inserting the literal string "\n" at the end of the addressline and not the newline represented by \n if that makes sense.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
huerita37Author Commented:
Thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.