Thursday, July 17, 2014

Put new line character in select statement

Several times we need to show the values in new line which is fetched thorugh select statement and put them in a label or textbox. Then there is a function CHAR() in sql server through which we can get our desired result.
Control character
Value
Tab
char(9)
Line feed
char(10)
Carriage return
char(13)
Example-:

select profile + CHAR(13)+CHAR(10) + address +CHAR(13)+CHAR(10)+phone, export_ref from tbl_profile