Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
apvani
Starting Member
6 Posts |
Posted - 2011-10-17 : 15:19:19
|
| Hi,I have a table with address column.value in the address colum has valueswhen i select addr from table it givesaddrs1000 expresslane1500 southwestpark apt#10I want to see output as1000,expresslane1500,southwestpark,apt#10I am generating a report and user wants to see the address seperated with commascan any one help on this please. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-10-17 : 21:54:22
|
how do you determine where to insert the commas ?what if your address is like "1500 south west park apt#10" ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
jassi.singh
Posting Yak Master
122 Posts |
Posted - 2011-10-18 : 01:26:07
|
| hI YOU CAN USE stuff,Please check belowSELECT STUFF('1000 expresslane',5,1,',')Please mark answer as accepted if it helped you.Thanks,Jassi Singh |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-18 : 01:58:19
|
quote: Originally posted by jassi.singh hI YOU CAN USE stuff,Please check belowSELECT STUFF('1000 expresslane',5,1,',')Please mark answer as accepted if it helped you.Thanks,Jassi Singh
what about 1500 southwestpark apt#10? did you test it for all the sample data provided?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
apvani
Starting Member
6 Posts |
Posted - 2011-10-18 : 12:26:43
|
| Hi JessiStuff works only when we know length and where to place comma.which I dont know.I think so this is not possible because I dont know exactly how to determine where do we have to place comma.Thank you for the replies! Please let me know if you find anything around this issue. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-19 : 05:14:32
|
| you didnt reply question asked by Tan yet------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
sqlmaster555112
Starting Member
13 Posts |
Posted - 2011-10-19 : 13:25:47
|
| Hi try Replace function for itupdate address set addr = replace(addr,' ',',')Try this I think this may work if not let me know coz what this replace will do is that it will replace all spaces with ,@sqlmasterhttp://www.intelcs.com/SQL_Server_Consultant.aspx |
 |
|
|
|
|
|
|
|