Extract values from a string using a delimiter

There are many occasions in programs where you need to manipulate strings of characters that are delimited by a particular character, such as a comma, or a space. This function enables you to extract a substring from the string at a specified occurence of the delimter. declare @Data varchar(255) set @Data = 'A,B,C,D,E' print dbo.field(@data,',',2,2) […]

4.17 (6)

2011-11-07 (first published: )

2,454 reads

Blogs

It’s 2021, so why are you reading this?

By

If you’re reading this, there’s a good chance you’re straight, white, male, and English-speaking....

Daily Coping 20 Jan 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

[Coping] Hidden Wounds

By

Through high school and college, I carried deep wounds due to what was going...

Read the latest Blogs

Forums

Execute As not reading system view

By pdanes

I have a stored procedure with the following: SELECT physical_name FROM sys.master_files Where physical_name...

Find unmatched between 2 tables using field as selection criteria

By McGoo2000

I have the following tables as a example. Table 1 EmpID, LastName, FirstName 1,Smith,John...

update using self-join - confirm it looks at old values

By ztoddw

I'm doing an update using a self-join, and just want to confirm something.  If...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers