Created
October 30, 2017 19:46
-
-
Save samirbehara-zz/94e48120c8ba8ab9aac61fce04ca5614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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