sql split string by space 1

sql split string by space

SELECT SUBSTRING('please notify the sender at the e-mail address above',0,30 +
charindex(' ',SUBSTRING('please notify the sender at the e-mail address above',31,len('please notify the sender at the e-mail address above')))
 )
 as part1,
 
 SUBSTRING('please notify the sender at the e-mail address above',30+ charindex(' ',SUBSTRING('please notify the sender at the e-mail address above',31,len('please notify the sender at the e-mail address above'))),len('please notify the sender at the e-mail address above')) as part2

Here is what the above code is Doing:
1. The first part of the code is finding the first space after the 30th character.
2. The second part of the code is finding the first 30 characters.
3. The third part of the code is finding the remaining characters after the first 30 characters.

Similar Posts