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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Comma separated

Author  Topic 

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-03-06 : 04:15:16
'Z3184 Vaibahv Tiwari'
I need to make it comma saperated
as in our application we were concatenating strings with spaces
but many persons has given space after the any of the string
then there will be two string so now its difficult to make it saperate
as we can not directly replace with ',' because for each space there will be a comma
so for two consecutive space there will be two commas.
Please help me out.
thanks in advance.

Vabhav T

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-03-06 : 07:17:40
Please help me its urgent.
I am trying a lot to get the solution but no

Vabhav T
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-06 : 08:26:28
why not just change the application when concatenate the string, separate with comma ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-06 : 08:36:53
KH is right that would be the easiest way.

Then you only have to correct the old data which is already in the table.
How many spaces can be between two words?
If only two then you go in first step to replace two spaces by one space and then replace the reminding spaces by comma...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-03-08 : 01:31:11
Yes webgfred you are right and we have changed logic in application as there was the loop hole of space now we are concatinating with comma
thats why now for old data i need update. moreover that is not fix that there will be two spaces because we did not care about user entry that there might be possible that user can enter the value with spaces.

Vabhav T
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-08 : 02:11:40
See if this helps
http://beyondrelational.com/blogs/madhivanan/archive/2007/12/06/squeeze-function.aspx

You can then replace single space to a comma

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-08 : 13:56:36
quote:
Originally posted by madhivanan

See if this helps
http://beyondrelational.com/blogs/madhivanan/archive/2007/12/06/squeeze-function.aspx

You can then replace single space to a comma

Madhivanan

Failing to plan is Planning to fail


That's great!
I wished to have that trick in the past.
But now I have it for the future!
very cool madhi.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-09 : 01:01:16
quote:
Originally posted by webfred

quote:
Originally posted by madhivanan

See if this helps
http://beyondrelational.com/blogs/madhivanan/archive/2007/12/06/squeeze-function.aspx

You can then replace single space to a comma

Madhivanan

Failing to plan is Planning to fail


That's great!
I wished to have that trick in the past.
But now I have it for the future!
very cool madhi.


No, you're never too old to Yak'n'Roll if you're too young to die.


Thanks

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-18 : 08:45:23
Are you able to solve this problem?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -