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)

String tokenizing / splitting

By Irfan Baig,

Simply copy and paste the Split() function code in your T-SQL code editor, to select appropriate DB from database combo box and then press F5 key to create user defined Split() function.

Now you can use it as follows:

1. The first parameter of function is string that you need to split.

2. And second parameter of function is delimiter.

 

SELECT * FROM dbo.Split ('Token1;Token2;Token3;Token4;Token5',';')

 

The Expected output will be as follow:

Token1

Token2

Token3

Token4

Token5

Total article views: 1969 | Views in the last 30 days: 4
 
Related Articles
SCRIPT

Split function with store procedure

This example return a value with split function

FORUM

Use of Split Function in Reports

Use of Split Function in Reports

SCRIPT

Split and concatenate function

Function for splitting the values in string, applying logic and concatenating back to string.

SCRIPT

Function to Split Multivalued Parameter

This Function is written to split Multivalued Parameter passed by Reporting Services 2005.

BLOG

SQL Server – STRING_SPLIT function in SQL Server 2016

Hi friends, in SQL server 2016 another new function STRING_SPLIT gets introduced which helps in spli...

Tags
string manipulation    
t-sql    
 
Contribute