Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CHAR(10) sometimes work Expand / Collapse
Author
Message
Posted Wednesday, April 3, 2013 10:49 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Sunday, January 5, 2014 5:16 AM
Points: 64, Visits: 153
IN SQL

I want to print for example

Ali
is going to Alex


so I said

declare @x varchar(max) set @x = 'Ali' + CHAR(10) + 'is going to Alex'


in some servers it work very well in tohers not even with using CHAR(13)

the output appear in one line instead of two ones

any idea how to fix that, and make it work in all servers
Post #1438485
Posted Wednesday, April 3, 2013 11:02 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:04 AM
Points: 12,957, Visits: 32,489
how are you determining it doesn't display right on some servers but not other servers?

the data will have the control characters no matter what in them, but it's up to the presentation layer to determine whether to display something as multi line or not.

note, for example, in SSMS, the gridview never wraps to multi line, only text view does; could it be something that simple?



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1438493
Posted Thursday, April 4, 2013 11:34 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, September 19, 2014 1:08 PM
Points: 80, Visits: 351
There are two different ways to display query results in the SQL Server Management Studio (SSMS) - text or grid view. Per the previous post, they act differently.

I guess the question is where are you determining it does not work??

Remember, WINDOWS versus UNIX differs in end of line (EOL) markers. WINDOWS = CR+LF: CR (U+000D) followed by LF (U+000A), UNIX = LF only.

Something many people forget when transferring files.

We wait to hear back from you on what tool you are using to determine that the EOL characters are not there.





John Miner
Crafty DBA
www.craftydba.com
Post #1438935
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse