Carriage returns : LUSENET : SQL Server Database Administration : One Thread

Firstly I would like to thank Eric for answering my questions, they have been very beneficial. Secondly, thankyou all for putting up with my continual questioning, I apologise profusely for my ignorance. Anyway, here is the next question: Is there a command which allows carriage returns in the row of a relation? which when displayed permits multi-line presentation. Or alternatively, is there a way of displaying the results vertically as opposed to horizontally? yours, eager to learn, Matt

-- Anonymous, August 10, 1999



There are two ways to do this. First, put the carriage returns in your SQL statement. That is, when inserting a quoted string, put the close quote on the line after the open quote. Second, explicitly add the carriage return and line feed characters with the char function. For instance:

create table linedata (linedata char (255))

insert linedata values ('line 1' + char(13) + char(10) + 'line 2')

Remember, if you are displaying data on a web page, you need to either use the BR tag or the PRE tag.

Good luck,


-- Anonymous, August 10, 1999

Moderation questions? read the FAQ