Home > database >  How to print out formatted text after taking it from SQL server
How to print out formatted text after taking it from SQL server

Time:11-07

I have some problems with printing out the content that is formatted before inserting it into SQL server. Like I have inputted a multiple-row text, then it is inserted to SQL server and when I print it out, they display in the same row. This is the input

and this is the output

CodePudding user response:

You can use CHAR(10)/CHAR(13) Or Both between Strings while inserting them in table. Then select should print them separately in your output window.

e.g.

-- For CHAR(13) SELECT 'One' CHAR(13) 'two' as Val

-- For CHAR(10) SELECT 'One' CHAR(10) 'two' as Val

CodePudding user response:

You should know that making a multiple line input doesn't make it actually multiple if there is no breakpoint or "br" tag between them. And HTML doesn't add a "br" tag automatically into a text area.

The solution is to use a text editor.

  • Related