Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 1889 | 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.

FORUM

LIKE (Wild Card) Functionality in Conditional Split Transformation

LIKE (Wild Card) Functionality in Conditional Split Transformation

Tags
string manipulation    
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones