Click here to Skip to main content
12,406,592 members (48,625 online)
Rate this:
 
Please Sign up or sign in to vote.
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 5-Jul-12 22:06pm
khan46320
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Manas Bhardwaj 6-Jul-12 5:47am
   
This is correct +5!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Assuming you are doing it in 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(",", ",
");    //in case it is goiing on web form
  Permalink  
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

HI All,
 
Thanks for your quick responses,
Surprisingly,this
 
<br>', ''
 
 worked in sql server function .Now i am getting required output
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160730.1 | Last Updated 6 Jul 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100