Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DROP TABLE IF EXISTS dbo.EmployeeSkills
--Create a sample table
CREATE TABLE dbo.EmployeeSkills
(
EmployeeID INT IDENTITY PRIMARY KEY,
FirstName VARCHAR(50),
Email VARCHAR(50),
Skills VARCHAR(100)
)
INSERT INTO dbo.EmployeeSkills
(FirstName, Email, Skills) VALUES
('Samir', 'samirbehara@gmail.com', '.Net, SQL' ),
('Peter', 'peterdenner@yahoo.com', 'Java, COBOL' ),
('Dennis','dennisknox@hotmail.com','Oracle, C#');
SELECT * FROM dbo.EmployeeSkills
-- Split comma separated value string in a table column
SELECT EmployeeID, FirstName, Email , value
FROM dbo.EmployeeSkills
CROSS APPLY string_split(Skills, ',')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment