Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check my data in SQL Server have carriage return and line feed? [duplicate]

Tags:

sql

sql-server

Facing a problem, it seems my data stored in SQL Server does not stored correctly, simply put, how to verify that a varchar data has carriage return and line feed in it? I try to print them out, does not show the special characters. Thanks

like image 834
TOMMY WANG Avatar asked Apr 10 '12 15:04

TOMMY WANG


2 Answers

To add to what others have said; when I need to embed newlines in T-SQL, I tend to do;

DECLARE @nl CHAR(2) = CHAR(13) + CHAR(10);

..then use @nl as required. That's for Windows line-endings, naturally.

like image 197
Rory Hunter Avatar answered Oct 30 '22 02:10

Rory Hunter


Take a look at the Char function. See MSDN. This will help look for the special characters.

like image 22
Jon Egerton Avatar answered Oct 30 '22 04:10

Jon Egerton