Last active
March 17, 2016 18:51
-
-
Save zzzprojects/b9f28072093f320ca450 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
-- CREATE test table | |
DECLARE @SourceTable TABLE | |
( | |
RowID INT , | |
DelimitedString VARCHAR(8000) | |
) | |
INSERT INTO @SourceTable | |
VALUES ( 1, 'b;a' ), | |
( 2, 'c;a;b' ) | |
-- DECLARE expression to evaluate | |
DECLARE @sqlnet SQLNET = SQLNET::New('Split(s, ";").OrderBy(x => x)') | |
-- 1 | a | |
-- 1 | b | |
-- 2 | a | |
-- 2 | b | |
-- 2 | c | |
SELECT RowID , | |
Value_1 | |
FROM @SourceTable | |
CROSS APPLY ( SELECT Value_1 | |
FROM dbo.SQLNET_EvalTVF_1(@sqlnet.ValueString('s', | |
DelimitedString)) | |
) AS SplitTable | |
ORDER BY RowID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment