SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CHAR(10) sometimes work


CHAR(10) sometimes work

Author
Message
ali.m.habib
ali.m.habib
SSC-Enthusiastic
SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)

Group: General Forum Members
Points: 104 Visits: 163
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
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28187 Visits: 39951
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

j.miner
j.miner
SSC-Enthusiastic
SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)SSC-Enthusiastic (152 reputation)

Group: General Forum Members
Points: 152 Visits: 358
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search