TSQL + string split code example

Example 1: sql server 2016 split string

SELECT value FROM STRING_SPLIT('Lorem ipsum dolor sit amet.', ' ');

Example 2: 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

Tags:

Sql Example