Reputation: 173
I am getting records from database as comma separated. I am getting contact titles as:
greg w.workcerf, ashir ali, asdddfgjk
This is comma separated has been defined in SQL function getCommaListTitle()
What i want is to get these record on new lines as
greg w.workcerf,
ashir ali,
asdddfgjk
Any idea about what should i use in sql function instead of ','
Upvotes: 17
Views: 38842
Reputation: 29667
Append after the comma in getCommaListTitle
, CHAR(13) + CHAR(10)
for a
new line
CHAR(13)
is a new line char and CHAR(10)
is a line feed.
See http://msdn.microsoft.com/en-us/library/ms187323.aspx
Upvotes: 48
Reputation: 1066
use the replace
function
replace(field, ',', ',' + char(13)+char(10)
...however DO NOT do this in your database, database is about DATA and of course it 'should' be presented in some form... but starting with a line break, and finally you'll end with something like:
SELECT @s = '<tr><td>' + firstname + '</td><td>' + substr(lastname, 1, 30) + '</td></tr>'
FROM ....
RETURN '<table>' + @s + '</TABLE>'
and that is not to route to choose grasshopper
Upvotes: 3
Reputation: 19619
You should do this in your front end, like on data access layer or may be at presentation layer because your application could be any one a web app or a window app and in both there's different in new line syntax like in web we use <br/>
tag whereas in window we use /n
.
Upvotes: 4