Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
HI,

I am getting records from database(sql server)as comma separated.I am getting contact
titles as

greg w.workcerf,ashir ali,asdddfgjk

This is comma separater 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 ','
Posted

If I understood correct, you need to go and change your SQL Function getCommaListTitle.

Here in your SQL function, after your ',' put CHAR(13); or CHAR(10);
This will insert carriage return(code 13) or newline feed(code 10) in the text leading to the text format as you are trying to get.
 
Share this answer
 
Comments
Manas Bhardwaj 6-Jul-12 5:47am    
This is correct +5!
Assuming you are doing it in C#.

C#
string s = "greg w.workcerf,ashir ali,asdddfgjk";

string finalString = s.Replace(",", ",\r\n");    //in case it is goiing on windows form
string finalString = s.Replace(",", ",<br />");    //in case it is goiing on web form
 
Share this answer
 
Comments
Sandeep Mewara 6-Jul-12 4:27am    
Our interpretation differ here. Lets see!
Rahul Rajat Singh 6-Jul-12 4:29am    
interpretation are different but both our solutions are correct in their own way(perhaps not in the context of this question). +5 for your solution, liked it.
Manas Bhardwaj 6-Jul-12 5:49am    
This is correct. Personally, I would do it at SQL Server (but, that's just me :)). I voted 4.
XML
HI All,

Thanks for your quick responses,
Surprisingly,this

<br>', ''

 worked in sql server function .Now i am getting required output
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900