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)
 Need help splitting a string based on length/space

Author  Topic 

Planet_x
Starting Member

15 Posts

Posted - 2010-09-06 : 11:24:14
I am trying to split up a string based on length and position of space character, but cannot figure it out. I have a string like -
"this is a test string for testing functions"

I need to split this up into strings not longer than 20 characters but if there is a space occuring at 16-20 then it should be split into the next group of characters so like-

"this is a test"
"string for testing"
"functions"

I can split by spaces but having problems splitting by the space and the length of characters together, appreciate any assistance.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-09-06 : 11:27:52
See my response here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=149714



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Planet_x
Starting Member

15 Posts

Posted - 2010-09-06 : 12:15:35
Thanks!
Go to Top of Page
   

- Advertisement -