Thursday 2 September 2010

Splitting string with deliminator In SQL Server



During my work I came to a problem where I had to extract some numbers from a comma

separated list of numbers in TSQL 2008 (Sql Server).
I had to extract last seven numbers from a comma separated list of 14 numbers.
Just for the start I created a table function called ufn_Split.
This function takes two arguments:
1. Data
2. Deliminator
And it returns the split data in a tabular format.
Below is the function :


___________________________________________________________________
Mitul Patel
___________________________________________________________________

I recommend the following books to improve your T-SQL Skills.

2 comments:

Gurnam Madan said...

what is the use of @lCount ?

Mitul Patel said...

Oooops...
there is no use of it.
Thanks for pointing it out. I'm going to update it straight away.