Click on the banner to learn about and purchase my database training on Azure

How to wrap a string in a substring table using a delimiter in SQL Server

Views: 6.528 views
This post is the 3 part of 5 in the series. string Split
Reading Time: 2 minutes

Hello people,
Good afternoon!

In this post I will demonstrate a very nice table-valued function that lets you break a string in a substring table using a delimiter in SQL Server. What does that mean? Well, this makes you have a string and the function will turn that string into a table using a separator. In this table, each record will be a part of the string in the i + 1 index and you can easily work with these substrings.

Interested in learning more about split?

Function Usage Examples

SQL Server - fncSplitText How to wrap a string in a substring table using a delimiter

How to implement this in your SQL Server database

This is the cool part: Get to work!
View source

Creating the function with the CLR

Another alternative to using this feature is through SQLCLR, a feature that allows you to create .NET code within the database and generally performs much better than Transact-SQL. If you do not know the CLR, learn more by accessing the post. Introduction to SQL Common Language Runtime (CLR) in SQL Server.

View C # Function (CLR) Source Code

Simple and practical, right?
Hugs!

sql server tsql query table function split explode text string substring break word function using delimiter delimiter

sql server tsql query table function split explode text string substring break word function using delimiter delimiter