Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 carriage return

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-14 : 05:15:20
A text which I am trying to import into a varchar(max) field, contains line feeds and carriage returns i.e.

-----2000------

This is the text

How do I get sql to store the carriage returns in the field so that when I display the text, it shows with the carriage returns instead of just a line of text?
Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-14 : 05:53:57
The carriage returns are not displayed in GRID mode. Use TEXT mode to see the carriage returns.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-14 : 08:56:34
I am not allowed to change the datatype of the field as it is a third party design.
And what do you mean by GRID mode please?
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-14 : 09:08:17
quote:
Originally posted by arkiboys

I am not allowed to change the datatype of the field as it is a third party design.
And what do you mean by GRID mode please?
Thanks


peso was telling you to change display mode of results in sql management studio. you've two modes gid and text available on top toolbar.
Go to Top of Page

ron2112
Starting Member

44 Posts

Posted - 2009-01-14 : 09:08:40
You don't need to change the data type, just the way you're displaying the data. In Management Studio, there are toolbar buttons just to the left of the Commment buttons: Results To Text, Results To Grid, Results To File. If you change over to Results To Text, you should see the line breaks.
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-14 : 12:47:23
I see.
Apologies for mis-understanding.
The goal is to get the text properly displayed on a web UI.
At present it does not show the carriage return.
I wonder if there is something I should do to the data in the table field.
Note that I do not have control on the web UI code.
Any thoughts please?
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-14 : 12:48:42
and you're sure that table contains carriage return characters?
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-14 : 16:15:38
I run a select query and the result is shown in text mode.
There is carriage return.
i.e.

-----2008------

there is some text here...
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-14 : 16:24:42
If you can see the carriage return by running a select query in Management Studio, then the issue is within the application.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-14 : 17:18:14
How about if I place chr(13) ithin the text in the field. Will that make a difference?
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-01-14 : 17:21:44
As people have pointed out, the information is correctly being stored in the database. It is a front end issue, and most likley there is nothing you will be able to change on the back-end to make it display properly on the front.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-01-15 : 01:40:22
Thank you all.
Go to Top of Page
   

- Advertisement -