In SQL SERVER, how to see multiple column values in new line -
i have data present in sql server following format
sa path_information ------ ------ 1 h drive - h:\baa\c,h drive - h:\caa\d, des- f:\detail ------- ------------- 2 oracle: h:\baa\c, excel: h:\caa\d
but, want in
sa path_information ---------------- 1 h drive - h:\baa\c h drive - h:\caa\d des - f:\detail ------- ----------- 2 oracle: h:\baa\c excel: h:\caa\d
with every path information in on new line of same row. so, can please tell how that? thanks
you store line breaks , carriage returns in data, though won't see reflected in ssms.
i use both results across many applications, you'd want stick char(13) + char(10)
want line break.
in case, if commas divider, can replace commas aforementioned 2-character string.
you can store such, or query way display purposes.
documentation using char: https://docs.microsoft.com/en-us/sql/t-sql/functions/char-transact-sql
edit:
if want select these values, can use replace function shown below:
select sa ,replace(path_information,',',char(13)+char(10)) mytable
if want update database store way, following:
update mytable set path_information = replace(path_information,',',char(13)+char(10))
Comments
Post a Comment