Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

SPLIT function

By Mateus Espadoto,

This is a port of the SPLIT function from Perl (or VBScript). It works the same way: pass a string and
a separator, up to 4 characters long (you can change this),
and the function returns a table with the elements.
This version trims leading and trailling spaces of the
elements, just for convenience.

Example:

SELECT    strval
FROM    master.dbo.SPLIT('a and b', 'and')

returns:

strval                                                                                              
------
a
b

Total article views: 185 | Views in the last 30 days: 1
 
Tags
miscellaneous    
t-sql    
 
Contribute