Last active
March 17, 2016 18:51
-
-
Save zzzprojects/934150b303b447fc297d 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, '1;2;3;4;5' ), | |
( 2, '2;4;6;8' ), | |
( 3, '3;6') | |
-- DECLARE expression to evaluate | |
DECLARE @sqlnet SQLNET = SQLNET::New('Split(s, ";").Sum(x => Convert.ToInt32(x))') | |
-- 1 | 15 | |
-- 2 | 20 | |
-- 3 | 9 | |
SELECT RowID , | |
@sqlnet.ValueString('s', DelimitedString).EvalString() | |
FROM @SourceTable | |
ORDER BY RowID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment