Last post Dec 19, 2018 06:41 AM by Fei Han - MSFT
Dec 18, 2018 04:34 PM|gunderj|LINK
For this simple example...
DECLARE @strPrint VARCHAR(100);
SET @strPrint = 'Example of carriage return';
SET @strPrint = @strPrint + CHAR(13);
SET @strPrint = @strPrint + 'SQLAuthority.com';
The above uses the CHAR(13) to force a carriage return, or two lines of text. The print works fine in the Results window of MSSMS but the select does not - you just get a single line of text.
How can I get the select @strPrint; to recognize the carriage return? My requirement is for this text to be in a razor web page div where the carriage return is needed. Thanks.
Dec 18, 2018 06:30 PM|mgebhard|LINK
Browsers do not render white space characters. Add a '<br />' not CHAR(13).
Dec 19, 2018 06:41 AM|Fei Han - MSFT|LINK
How can I get the select @strPrint; to recognize the carriage return? My requirement is for this text to be in a razor web page div where the carriage return is needed.
If you check the source code of html, you will find it would be rendered like below in browser.
To display the content in two lines in your web page, you can try apply the following css style to the element(s).